Python基础 · 免费预览
命令行程序
在程序中使用命令行参数的值。在命令行程序中分别处理标志与文件。让程序能从标准输入读取数据,从而接入流水线。
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