Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
python command line arguments
import sys
def main():
if len(sys.argv) == 2:
print(f"the program name is {sys.argv[0]}")
print(f"hello, {sys.argv[1]}")
for eachArg in sys.argv:
for eachChar in eachArg:
print() # a line break between each vertical word
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment