If you need to make a very simple command-line interface and it doesn't need to be friendly, you can read sys.argv to manually process the arguments coming into your program.
If you're trying to make a friendly command-line interface in Python, instead of manually parsing sys.argv you should probably use Python's argparse module.
How can you setup a main function in Python? And should you? Python doesn't know about main functions, but there's nothing stopping us from defining a function called main that we only call when running from the command-line.
A script or program is a .py file that's meant to be run directly. A module is a .py file that's meant to be imported by other .py files. Sometimes Python files are both modules and scripts.
Continue exploring
Learn something new about Python every week
My name is Trey Hunner. I publish new Python articles and screencasts every week through Python Morsels. If you want to learn something new about Python every week, join Python Morsels!