[译] Python 2.7.6 标准库——15. 通用操作系统服务
15. 通用操作系统服务
本章所描述的模块提供了面向操作系统特性的接口,并且几乎适用于所有操作系统,如文件和时钟等。这些接口的模型基本是按照Unix或C语言接口来设计的,但它们也适用于其他操作系统。以下是总体概况:
- 15.1. os — 各种操作系统接口(Miscellaneous operating system interfaces)
- 15.2. io — 操作流的核心工具(Core tools for working with streams)
- 15.3. time — 时间访问和转换(Time access and conversions)
- 15.4. argparse — 命令行选项、参数和子命令解析器(Parser for command-line options, arguments and sub-commands)
- 15.5. optparse — 命令行选项解析器(Parser for command line options)
- 15.5.1. 背景(Background)
- 15.5.2. 使用指导(Tutorial)
- 15.5.2.1. 理解选项动作(Understanding option actions)
- 15.5.2.2. 存储动作(The store action)
- 15.5.2.3. 处理boolean选项(Handling boolean (flag) options)
- 15.5.2.4. 其他动作(Other actions)
- 15.5.2.5. 默认值(Default values)
- 15.5.2.6. 产生帮助信息(Generating help)
- 15.5.2.7. 打印版本字符串(Printing a version string)
- 15.5.2.8. optparse如何处理错误(How optparse handles errors)
- 15.5.2.9. 综合(Putting it all together)
- 15.5.3. 参考指南(Reference Guide)
- 15.5.3.1. 创建解析器(Creating the parser)
- 15.5.3.2. Populating the parser?
- 15.5.3.3. 定义选项(Defining options)
- 15.5.3.4. 选项的属性(Option attributes)
- 15.5.3.5. 标准选项动作(Standard option actions)
- 15.5.3.6. 标准选项类型(Standard option types)
- 15.5.3.7. 解析参数(Parsing arguments)
- 15.5.3.8. 查询和使用选项解析器(Querying and manipulating your option parser)
- 15.5.3.9. 选项冲突(Conflicts between options)
- 15.5.3.10. 清理(Cleanup)
- 15.5.3.11. 其他方法(Other methods)
- 15.5.4. 选项回调(Option Callbacks)
- 15.5.4.1. 定义回调选项(Defining a callback option)
- 15.5.4.2. 回调函数如何被调用(How callbacks are called)
- 15.5.4.3. 回调中引发errors(Raising errors in a callback)
- 15.5.4.4. 回调示例1: 简单回调(Callback example 1: trivial callback)
- 15.5.4.5. 回调示例2: 检查选项顺序(Callback example 2: check option order)
- 15.5.4.6. 回调示例3: 检查选项顺序——进阶?(Callback example 3: check option order (generalized))
- 15.5.4.7. 回调示例4: 检查任意条件(Callback example 4: check arbitrary condition)
- 15.5.4.8. 回调示例5: 固定参数(Callback example 5: fixed arguments)
- 15.5.4.9. 回调示例6: 可变参数(Callback example 6: variable arguments)
- 15.5.5. 扩展optparse(Extending optparse)
- 15.6. getopt — C风格命令行解析器(C-style parser for command line options)
- 15.7. logging — Python日志工具(Logging facility for Python)
- 15.7.1. Logger对象(Logger Objects)
- 15.7.2. 日志级别(Logging Levels)
- 15.7.3. Handler处理器对象(Handler Objects)
- 15.7.4. Formatter格式化对象(Formatter Objects)
- 15.7.5. Filter过滤器对象(Filter Objects)
- 15.7.6. LogRecord日志记录对象(LogRecord Objects)
- 15.7.7. LogRecord日志记录属性(LogRecord attributes)
- 15.7.8. LoggerAdapter日志适配器对象(LoggerAdapter Objects)
- 15.7.9. 线程安全(Thread Safety)
- 15.7.10. 模块级函数(Module-Level Functions)
- 15.7.11. 整合warnings警告模块(Integration with the warnings module)
- 15.8. logging.config — 日志配置(Logging configuration)
- 15.9. logging.handlers — 日志处理器(Logging handlers)
- 15.9.1. 流处理器(StreamHandler)
- 15.9.2. 文件处理器(FileHandler)
- 15.9.3. Null值处理器(NullHandler)
- 15.9.4. 监视?文件处理器(WatchedFileHandler)
- 15.9.5. 轮转?文件处理器(RotatingFileHandler)
- 15.9.6. 时间轮转?文件处理器(TimedRotatingFileHandler)
- 15.9.7. 套接字处理器(SocketHandler)
- 15.9.8. 数据报处理器(DatagramHandler)
- 15.9.9. 系统日志处理器(SysLogHandler)
- 15.9.10. NT事件日志处理器(NTEventLogHandler)
- 15.9.11. SMTP处理器(SMTPHandler)
- 15.9.12. 内存处理器(MemoryHandler)
- 15.9.13. HTTP处理器(HTTPHandler)
- 15.10. getpass — 可移植密码输入(Portable password input)
- 15.11. curses — 显示字符单元?的终端处理(Terminal handling for character-cell displays)
- 15.12. curses.textpad — 游标程序的文本输入部件?(Text input widget for curses programs)
- 15.13. curses.ascii — ASCII字符工具(Utilities for ASCII characters)
- 15.14. curses.panel — 游标面板栈扩展?(A panel stack extension for curses)
- 15.15. platform — Access to underlying platform’s identifying data
- 15.16. errno — Standard errno system symbols
- 15.17. ctypes — A foreign function library for Python
- 15.17.1. ctypes tutorial
- 15.17.1.1. Loading dynamic link libraries
- 15.17.1.2. Accessing functions from loaded dlls
- 15.17.1.3. Calling functions
- 15.17.1.4. Fundamental data types
- 15.17.1.5. Calling functions, continued
- 15.17.1.6. Calling functions with your own custom data types
- 15.17.1.7. Specifying the required argument types (function prototypes)
- 15.17.1.8. Return types
- 15.17.1.9. Passing pointers (or: passing parameters by reference)
- 15.17.1.10. Structures and unions
- 15.17.1.11. Structure/union alignment and byte order
- 15.17.1.12. Bit fields in structures and unions
- 15.17.1.13. Arrays
- 15.17.1.14. Pointers
- 15.17.1.15. Type conversions
- 15.17.1.16. Incomplete Types
- 15.17.1.17. Callback functions
- 15.17.1.18. Accessing values exported from dlls
- 15.17.1.19. Surprises
- 15.17.1.20. Variable-sized data types
- 15.17.2. ctypes reference
- 15.17.1. ctypes tutorial