command line interfaces

I am a new Python programming user. I am working on user-friendly command-line interfaces, and I want to pass input via the shell args as follows:

./myscript.py filename
./myscript.py in.file output.file
./myscript.py -i in.file -o output.file

How do I pass and parse command-line options and arguments using Python under Unix like operating systems?

{ 7 comments }