15. 通用操作系统服务¶
本章中描述的各模块提供了在(几乎)所有的操作系统上可用的操作系统特性的接口,例如文件和时钟。这些接口通常以 Unix 或 C 接口为参照对象设计,不过在大多数其他系统上也可用。这里有一个概述:
- 15.1.
os
— 操作系统接口模块 - 15.2.
io
— 处理流的核心工具 - 15.3.
time
— 时间的访问和转换 - 15.4.
argparse
— 命令行选项、参数和子命令解析器 - 15.5.
optparse
— Parser for command line options- 15.5.1. Background
- 15.5.2. 教程
- 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. 解析参数
- 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. Raising errors in a callback
- 15.5.4.4. Callback example 1: trivial callback
- 15.5.4.5. Callback example 2: check option order
- 15.5.4.6. Callback example 3: check option order (generalized)
- 15.5.4.7. Callback example 4: check arbitrary condition
- 15.5.4.8. Callback example 5: fixed arguments
- 15.5.4.9. Callback example 6: variable arguments
- 15.5.5. Extending
optparse
- 15.6.
getopt
— C-style parser for command line options - 15.7.
logging
— Logging facility for Python - 15.8.
logging.config
— 日志记录配置 - 15.9.
logging.handlers
— Logging handlers- 15.9.1. StreamHandler
- 15.9.2. FileHandler
- 15.9.3. 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. NTEventLogHandler
- 15.9.11. SMTPHandler
- 15.9.12. MemoryHandler
- 15.9.13. HTTPHandler
- 15.10.
getpass
— 便携式密码输入工具 - 15.11.
curses
— 终端字符单元显示的处理 - 15.12.
curses.textpad
— Text input widget for curses programs - 15.13.
curses.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
— Python 的外部函数库- 15.17.1. ctypes 教程
- 15.17.1.1. 载入动态连接库
- 15.17.1.2. 操作导入的动态链接库中的函数
- 15.17.1.3. 调用函数
- 15.17.1.4. 基础数据类型
- 15.17.1.5. 调用函数,继续
- 15.17.1.6. 使用自定义的数据类型调用函数
- 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 教程