Python基础 · free preview

Command-Line Programs

Use the values of command-line arguments in a program. Handle flags and files separately in a command-line program. Read data from standard input in a program so that it can be used in a pipeline.

1. Overview

Overview

2. Switching to Shell Commands

Switching to Shell Commands

3. Command-Line Arguments

Command-Line Arguments

4. Running Versus Importing

Running Versus Importing

5. The Right Way to Do It

The Right Way to Do It

6. Handling Multiple Files

Handling Multiple Files

7. The Right Way to Do It

The Right Way to Do It

8. Handling Command-Line Flags

Handling Command-Line Flags

9. Handling Standard Input

Handling Standard Input

10. Arithmetic on the Command Line

Arithmetic on the Command Line

11. Finding Particular Files

Finding Particular Files

12. Changing Flags

Changing Flags

13. Adding a Help Message

Adding a Help Message

14. Adding a Default Action

Adding a Default Action

15. A File-Checker

A File-Checker

16. Counting Lines

Counting Lines

17. Generate an Error Message

Generate an Error Message

Practice this interactively

Free account · instant grading · spaced review that schedules itself.

Start this course for free