Command Line Programs - Lesson 10

Questions

  • How can I write Python programs that will work like Unix command-line tools?

Objectives

  • Use the values of command-line arguments in a program.
  • Handle flags and files separately in a command-line program.

Lecture

Jupyter Notebook File

Please use the Jupyter notebook named "10CommandLinePrograms.ipynb" for this lesson. If you haven't downloaded them already, you may find them here.

Key Points

  • The sys library connects a Python program to the system it is running on.
  • The list sys.argv contains the command-line arguments that a program was run with.