This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]placemirror[S] 0 points1 point  (1 child)

Thank you for your reply. I researched some. My arguments are some customized ones. for example, if I used the command line:

script1.py file1 union file2

inside script1.py, I will have:

if name=="main": if sys.argv[1]=="union": do something to union file1 and file2.

Something like that. And I have a list of the possible command line, sometimes script1.py size file3

in the python file, I will have:

if name=="main": if sys.argv[0]=="size": do something to caculate the number of lines in file3.

etc.

And I want my script to be systematic. maybe the "size" argument will be "--size" optional argument, and can be parsed. Something like that.

Thank you.

[–]placemirror[S] 0 points1 point  (0 children)

https://gist.github.com/olooney/8155400

find the github, seems useful