没有合适的资源?快使用搜索试试~ 我知道了~
首页Python 2.7.1 官方文档详解
"Python v2.7.1 文档是一个详细的PDF教程,适用于Python初学者和有经验的用户,提供了全面的Python 2.7.1版本的信息,包括语言变化、新特性、模块更新和移植指南等内容。"
本文档详细介绍了Python 2.7.1的主要特性,包括以下几个方面:
1. **What's New in Python 2.7**: 这部分详细阐述了Python 2.7版本中的更新和改进。Python 2.7是2.x系列的最后一个主要版本,它引入了一些向Python 3过渡的关键特性。
- **The Future for Python 2.x**: 讨论了Python 2.x系列的未来,以及最终停止支持的情况。
- **Python 3.1 Features**: 虽然文档主要针对Python 2.7,但也提及了一些从Python 3.1中借鉴的特性,以便于用户了解升级路径。
2. **PEPs (Python Enhancement Proposals)**: PEPs是Python社区为了改进语言和标准库提出的重要建议。在Python 2.7.1中,包含了以下PEP实现:
- **PEP 372**: 添加了一个有序字典到collections模块,增强了字典操作的顺序性。
- **PEP 378**: 引入了格式规范用于千分位分隔符,使数字格式化更易读。
- **PEP 389**: 引入了argparse模块,提供了一种更为强大的命令行参数解析方式。
- **PEP 391**: 更新了日志模块logging的基于字典的配置。
- **PEP 3106**: 介绍了字典视图(dictionary views),允许更高效地操作字典元素。
- **PEP 3137**: 引入了memoryview对象,优化了对内存缓冲区的处理。
3. **Other Language Changes, Interpreter Changes, Optimizations**: 这些章节讨论了语言层面和解释器的其他更改,包括性能提升和内部优化。
4. **New and Improved Modules**: 介绍了新的模块和现有模块的更新,如:
- **importlib**: 提供了一种动态加载模块的机制,增强了模块管理的灵活性。
- **sysconfig**: 提供了获取Python配置信息的方法,便于构建和安装过程。
- **ttk**: Themed Widgets for Tk,Tkinter库的扩展,提供了主题支持,使得GUI应用外观更一致。
- **unittest**: 单元测试模块的更新,提供了更多的功能和改进。
- **ElementTree 1.3**: XML处理库的更新,提升了性能和增加了新特性。
5. **Build and CAPI Changes**: 包括了构建系统的变化,如Capsules的引入,以及特定平台的改动,如Windows、MacOS X和FreeBSD上的调整。
6. **Porting to Python 2.7**: 提供了将代码从旧版本移植到Python 2.7的指导,帮助开发者平稳过渡。
7. **Acknowledgements**: 致谢部分,感谢所有对Python 2.7.1做出贡献的人。
这个文档不仅涵盖了语言层面的改变,还深入到解释器、模块和构建系统的改进,对于理解和使用Python 2.7.1至关重要。无论是学习Python的基础,还是想要深入了解特定的改进,这份文档都是一个宝贵的资源。
667
Writer Objects ................................................................................................................................................................
667
Examples ........................................................................................................................................................................
674
ConfigParser --- Configuration file parser
....................................................................................................................
674
RawConfigParser Objects ..............................................................................................................................................
674
ConfigParser Objects .....................................................................................................................................................
674
SafeConfigParser Objects ..............................................................................................................................................
674
Examples ........................................................................................................................................................................
680
robotparser --- Parser for robots.txt
.............................................................................................................................
681
netrc --- netrc file processing
..........................................................................................................................................
681
netrc Objects ..................................................................................................................................................................
682
xdrlib --- Encode and decode XDR data
.......................................................................................................................
682
Packer Objects ...............................................................................................................................................................
682
Unpacker Objects ...........................................................................................................................................................
682
Exceptions ......................................................................................................................................................................
685
plistlib --- Generate and parse Mac OS X .plist files
.................................................................................................
685
Examples ........................................................................................................................................................................
687
Cryptographic Services
.........................................................................................................................................................
688
hashlib --- Secure hashes and message digests
.......................................................................................................
690
hmac --- Keyed-Hashing for Message Authentication
..............................................................................................
691
md5 --- MD5 message digest algorithm
.......................................................................................................................
692
sha --- SHA-1 message digest algorithm
.....................................................................................................................
693
Generic Operating System Services
...............................................................................................................................
697
os --- Miscellaneous operating system interfaces
.....................................................................................................
697
Process Parameters .......................................................................................................................................................
697
File Object Creation ........................................................................................................................................................
697
File Descriptor Operations ..............................................................................................................................................
697
open() flag constants
................................................................................................................................................
697
Files and Directories .......................................................................................................................................................
697
Process Management .....................................................................................................................................................
697
Miscellaneous System Information .................................................................................................................................
697
Miscellaneous Functions ................................................................................................................................................
721
io --- Core tools for working with streams
....................................................................................................................
721
Module Interface .............................................................................................................................................................
721
I/O Base Classes ............................................................................................................................................................
721
Raw File I/O ....................................................................................................................................................................
721
Buffered Streams ............................................................................................................................................................
721
Text I/O ...........................................................................................................................................................................
729
time --- Time access and conversions
..........................................................................................................................
735
argparse --- Parser for command line options, arguments and sub-commands
...............................................
735
Example ..........................................................................................................................................................................
735
Creating a parser
......................................................................................................................................................
735
Adding arguments
....................................................................................................................................................
735
Parsing arguments
...................................................................................................................................................
735
ArgumentParser objects .................................................................................................................................................
735
description
...............................................................................................................................................................
735
epilog
......................................................................................................................................................................
735
add_help
.................................................................................................................................................................
735
prefix_chars
.............................................................................................................................................................
735
fromfile_prefix_chars
................................................................................................................................................
735
argument_default
.....................................................................................................................................................
735
parents
....................................................................................................................................................................
735
formatter_class
........................................................................................................................................................
735
conflict_handler
........................................................................................................................................................
735
prog
........................................................................................................................................................................
735
usage
......................................................................................................................................................................
735
The add_argument() method ..........................................................................................................................................
735
name or flags
...........................................................................................................................................................
735
action
......................................................................................................................................................................
735
nargs
......................................................................................................................................................................
735
const
.......................................................................................................................................................................
735
default
.....................................................................................................................................................................
735
type
.........................................................................................................................................................................
735
choices
...................................................................................................................................................................
735
required
...................................................................................................................................................................
735
help
........................................................................................................................................................................
735
metavar
...................................................................................................................................................................
735
dest
........................................................................................................................................................................
735
The parse_args() method ...............................................................................................................................................
735
Option value syntax
...................................................................................................................................................
735
Invalid arguments
.....................................................................................................................................................
735
Arguments containing "-"
...........................................................................................................................................
735
Argument abbreviations
.............................................................................................................................................
735
Beyond sys.argv
.......................................................................................................................................................
735
Custom namespaces
................................................................................................................................................
735
Other utilities ...................................................................................................................................................................
735
Sub-commands
........................................................................................................................................................
735
FileType objects
.......................................................................................................................................................
735
Argument groups
......................................................................................................................................................
735
Mutual exclusion
.......................................................................................................................................................
735
Parser defaults
.........................................................................................................................................................
735
Printing help
.............................................................................................................................................................
735
Partial parsing
..........................................................................................................................................................
735
Customizing file parsing
............................................................................................................................................
735
Exiting methods
........................................................................................................................................................
735
Upgrading optparse code ...............................................................................................................................................
756
optparse --- Parser for command line options
............................................................................................................
756
Background ....................................................................................................................................................................
756
Terminology
.............................................................................................................................................................
756
What are options for?
...............................................................................................................................................
756
What are positional arguments for?
............................................................................................................................
756
Tutorial ............................................................................................................................................................................
756
Understanding option actions
.....................................................................................................................................
756
The store action
.......................................................................................................................................................
756
Handling boolean (flag) options
..................................................................................................................................
756
Other actions
...........................................................................................................................................................
756
Default values
..........................................................................................................................................................
756
Generating help
........................................................................................................................................................
756
Printing a version string
.............................................................................................................................................
756
How optparse handles errors
.....................................................................................................................................
756
Putting it all together
.................................................................................................................................................
756
Reference Guide ............................................................................................................................................................
756
Creating the parser
...................................................................................................................................................
756
Populating the parser
................................................................................................................................................
756
Defining options
.......................................................................................................................................................
756
Option attributes
.......................................................................................................................................................
756
Standard option actions
.............................................................................................................................................
756
Standard option types
...............................................................................................................................................
756
Parsing arguments
...................................................................................................................................................
756
Querying and manipulating your option parser
.............................................................................................................
756
Conflicts between options
..........................................................................................................................................
756
Cleanup
...................................................................................................................................................................
756
Other methods
.........................................................................................................................................................
756
Option Callbacks ............................................................................................................................................................
756
Defining a callback option
..........................................................................................................................................
756
How callbacks are called
...........................................................................................................................................
756
Raising errors in a callback
.......................................................................................................................................
756
Callback example 1: trivial callback
............................................................................................................................
756
Callback example 2: check option order
......................................................................................................................
756
Callback example 3: check option order (generalized)
..................................................................................................
756
Callback example 4: check arbitrary condition
..............................................................................................................
756
Callback example 5: fixed arguments
..........................................................................................................................
756
Callback example 6: variable arguments
.....................................................................................................................
756
Extending optparse .........................................................................................................................................................
756
Adding new types
.....................................................................................................................................................
756
Adding new actions
...................................................................................................................................................
778
getopt --- C-style parser for command line options
...................................................................................................
780
logging --- Logging facility for Python
...........................................................................................................................
780
Logging tutorial ...............................................................................................................................................................
780
Simple examples
......................................................................................................................................................
780
Loggers
...................................................................................................................................................................
780
Handlers
..................................................................................................................................................................
780
Formatters
...............................................................................................................................................................
780
Configuring Logging
..................................................................................................................................................
780
Configuring Logging for a Library
................................................................................................................................
780
Logging Levels ................................................................................................................................................................
780
Custom Levels
.........................................................................................................................................................
780
Useful Handlers ..............................................................................................................................................................
780
Module-Level Functions ..................................................................................................................................................
780
Logger Objects ...............................................................................................................................................................
780
Basic example ................................................................................................................................................................
780
Logging to multiple destinations ......................................................................................................................................
780
Exceptions raised during logging ....................................................................................................................................
780
Adding contextual information to your logging output ......................................................................................................
780
Using LoggerAdapters to impart contextual information
................................................................................................
780
Using Filters to impart contextual information
..............................................................................................................
780
Logging to a single file from multiple processes .............................................................................................................
780
Sending and receiving logging events across a network .................................................................................................
780
Using arbitrary objects as messages ..............................................................................................................................
780
Optimization ....................................................................................................................................................................
780
Handler Objects ..............................................................................................................................................................
780
StreamHandler
.........................................................................................................................................................
780
FileHandler
..............................................................................................................................................................
780
NullHandler
..............................................................................................................................................................
780
WatchedFileHandler
.................................................................................................................................................
780
RotatingFileHandler
..................................................................................................................................................
780
TimedRotatingFileHandler
.........................................................................................................................................
780
SocketHandler
.........................................................................................................................................................
780
DatagramHandler
.....................................................................................................................................................
780
SysLogHandler
.........................................................................................................................................................
780
NTEventLogHandler
.................................................................................................................................................
780
SMTPHandler
..........................................................................................................................................................
780
MemoryHandler
........................................................................................................................................................
780
HTTPHandler
...........................................................................................................................................................
780
Formatter Objects ...........................................................................................................................................................
780
Filter Objects ..................................................................................................................................................................
780
Other uses for filters
.................................................................................................................................................
780
LogRecord Objects .........................................................................................................................................................
780
LoggerAdapter Objects ...................................................................................................................................................
780
Thread Safety .................................................................................................................................................................
780
Integration with the warnings module ..............................................................................................................................
780
Configuration ..................................................................................................................................................................
780
Configuration functions
.............................................................................................................................................
780
Configuration dictionary schema
................................................................................................................................
780
Dictionary Schema Details
.....................................................................................................................................
780
Incremental Configuration
......................................................................................................................................
780
Object connections
..............................................................................................................................................
780
User-defined objects
............................................................................................................................................
780
Access to external objects
.....................................................................................................................................
780
Access to internal objects
......................................................................................................................................
780
Configuration file format
............................................................................................................................................
780
Configuration server example
.....................................................................................................................................
780
More examples ...............................................................................................................................................................
780
Multiple handlers and formatters
................................................................................................................................
780
Using logging in multiple modules
..............................................................................................................................
819
getpass --- Portable password input
.............................................................................................................................
820
curses --- Terminal handling for character-cell displays
..........................................................................................
820
Functions ........................................................................................................................................................................
820
Window Objects .............................................................................................................................................................
820
Constants .......................................................................................................................................................................
820
curses.textpad --- Text input widget for curses programs
........................................................................................
820
Textbox objects ...............................................................................................................................................................
820
curses.wrapper --- Terminal handler for curses programs
......................................................................................
836
curses.ascii --- Utilities for ASCII characters
..............................................................................................................
839
curses.panel --- A panel stack extension for curses
..................................................................................................
839
Functions ........................................................................................................................................................................
839
Panel Objects .................................................................................................................................................................
841
platform --- Access to underlying platform's identifying data
................................................................................
841
Cross Platform ................................................................................................................................................................
841
Java Platform ..................................................................................................................................................................
841
Windows Platform ..........................................................................................................................................................
841
Win95/98 specific
.....................................................................................................................................................
841
Mac OS Platform ............................................................................................................................................................
841
Unix Platforms ................................................................................................................................................................
844
errno --- Standard errno system symbols
....................................................................................................................
850
ctypes --- A foreign function library for Python
...........................................................................................................
850
ctypes tutorial ..................................................................................................................................................................
850
Loading dynamic link libraries
....................................................................................................................................
850
Accessing functions from loaded dlls
..........................................................................................................................
850
Calling functions
.......................................................................................................................................................
850
Fundamental data types
............................................................................................................................................
850
Calling functions, continued
.......................................................................................................................................
850
Calling functions with your own custom data types
.......................................................................................................
850
Specifying the required argument types (function prototypes)
........................................................................................
850
Return types
............................................................................................................................................................
850
Passing pointers (or: passing parameters by reference)
................................................................................................
850
Structures and unions
...............................................................................................................................................
850
Structure/union alignment and byte order
....................................................................................................................
850
Bit fields in structures and unions
...............................................................................................................................
850
Arrays
.....................................................................................................................................................................
850
Pointers
...................................................................................................................................................................
850
Type conversions
......................................................................................................................................................
850
Incomplete Types
.....................................................................................................................................................
850
Callback functions
....................................................................................................................................................
850
Accessing values exported from dlls
...........................................................................................................................
850
Surprises
.................................................................................................................................................................
850
Variable-sized data types
...........................................................................................................................................
850
ctypes reference .............................................................................................................................................................
850
Finding shared libraries
.............................................................................................................................................
850
Loading shared libraries
............................................................................................................................................
850
Foreign functions
......................................................................................................................................................
850
Function prototypes
..................................................................................................................................................
850
Utility functions
.........................................................................................................................................................
850
Data types
...............................................................................................................................................................
850
Fundamental data types
............................................................................................................................................
850
Structured data types
................................................................................................................................................
850
Arrays and pointers
...................................................................................................................................................
877
Optional Operating System Services
.............................................................................................................................
878
select --- Waiting for I/O completion
.............................................................................................................................
878
Edge and Level Trigger Polling (epoll) Objects ...............................................................................................................
878
Polling Objects ...............................................................................................................................................................
878
Kqueue Objects ..............................................................................................................................................................
878
Kevent Objects ...............................................................................................................................................................
883
threading --- Higher-level threading interface
.............................................................................................................
883
Thread Objects ...............................................................................................................................................................
883
Lock Objects ...................................................................................................................................................................
883
RLock Objects ................................................................................................................................................................
883
Condition Objects ...........................................................................................................................................................
883
Semaphore Objects ........................................................................................................................................................
883
Semaphore Example
.................................................................................................................................................
883
Event Objects .................................................................................................................................................................
883
Timer Objects .................................................................................................................................................................
883
Using locks, conditions, and semaphores in the with statement .....................................................................................
883
Importing in threaded code .............................................................................................................................................
892
thread --- Multiple threads of control
.............................................................................................................................
894
dummy_threading --- Drop-in replacement for the threading module
..................................................................
剩余2121页未读,继续阅读
2011-08-09 上传
2011-06-30 上传
2024-04-02 上传
2021-08-15 上传
2011-02-12 上传
2024-04-02 上传
hzjiesj
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 火炬连体网络在MNIST的2D嵌入实现示例
- Angular插件增强Application Insights JavaScript SDK功能
- 实时三维重建:InfiniTAM的ros驱动应用
- Spring与Mybatis整合的配置与实践
- Vozy前端技术测试深入体验与模板参考
- React应用实现语音转文字功能介绍
- PHPMailer-6.6.4: PHP邮件收发类库的详细介绍
- Felineboard:为猫主人设计的交互式仪表板
- PGRFileManager:功能强大的开源Ajax文件管理器
- Pytest-Html定制测试报告与源代码封装教程
- Angular开发与部署指南:从创建到测试
- BASIC-BINARY-IPC系统:进程间通信的非阻塞接口
- LTK3D: Common Lisp中的基础3D图形实现
- Timer-Counter-Lister:官方源代码及更新发布
- Galaxia REST API:面向地球问题的解决方案
- Node.js模块:随机动物实例教程与源码解析
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功