Posts

Showing posts from March, 2023

Command Line Arguments in Python

Open the following as this in cmd: python filename.py argument from sys import argv if len(argv) == 2: print(f"Hello, {argv[1]}!") else: print("Hello, World!") # to see what is there in argv for arg in argv: print(arg)