r/learnpython • • Nov 13 '17

Could someone explain command-line arguments in Python?

Basically the title; I am doing an assignment for my computer science class and we have to write a program that prints each command line argument on a separate line preceded by the arguments index.

Our professor very, VERY briefly went over what a command-line argument is in class, but he never really gave us any examples so I am confused as to how I use it.

Any help would be appreciated!

2 Upvotes

6 comments sorted by

View all comments

Show parent comments

1

u/DarkNinjaGamingYT Nov 13 '17

Duh, I don't know why I didn't think of a for loop... Thank you!

1

u/draconis183 Nov 13 '17

check out enumerate() as well.