Python标准库被取代的模块
本章中描述的模块均已弃用,仅保留用于向后兼容。 它们已经被其他模块所取代。
optparse
--- 解析器的命令行选项- 背景
- 术语
- What are options for?
- 位置位置
- 教程
- Understanding option actions
- The store action
- Handling boolean (flag) options
- Other actions
- 默认值
- Generating help
- Grouping Options
- Printing a version string
- How
optparse
handles errors - Putting it all together
- 参考指南
- 创建解析器
- 填充解析器
- 定义选项
- Option attributes
- Standard option actions
- Standard option types
- 解析参数
- Querying and manipulating your option parser
- Conflicts between options
- 清理
- Other methods
- Option Callbacks
- Defining a callback option
- How callbacks are called
- Raising errors in a callback
- Callback example 1: trivial callback
- Callback example 2: check option order
- Callback example 3: check option order (generalized)
- Callback example 4: check arbitrary condition
- Callback example 5: fixed arguments
- Callback example 6: variable arguments
- Extending
optparse
- Adding new types
- Adding new actions
- 背景
imp
—— 由代码内部访问 import 。- 例子