开发工具:
文件大小: 1mb
下载次数: 0
上传时间: 2009-10-05
详细说明: 新手入门的Python书籍 Chapter 1. Installing Python..........................................................................................................................................2 1.1. Which Python is right for you?............................................. .........................................................................2 1.2. Python on Windows......................................................................................................................................2 1.3. Python on Mac OS X....................................................................................................................................3 1.4. Python on Mac OS 9.....................................................................................................................................5 1.5. Python on RedHat Linux..............................................................................................................................5 1.6. Python on Debian GNU/Linux......................................................................................................................6 1.7. Python Installation from Source....................................................................................................................6 1.8. The Interactive Shell.....................................................................................................................................7 1.9. Summary.......................................................................................................................................................8 Chapter 2. Your First Python Program........................................................................................................................9 2.1. Diving in.......................................................................................................................................................9 2.2. Declaring Functions......................................................................................................................................9 2.3. Documenting Functions..............................................................................................................................10 2.4. Everything Is an Object..............................................................................................................................11 2.5. Indenting Code............................................................................................................................................13 2.6. Testing Modules..........................................................................................................................................14 Chapter 3. Native Datatypes........................................................................................................................................15 3.1. Introducing Dictionaries.............................................................................................................................15 3.2. Introducing Lists.........................................................................................................................................17 3.3. Introducing Tuples......................................................................................................................................22 3.4. Declaring variables.....................................................................................................................................23 3.5. Formatting Strings......................................................................................................................................25 3.6. Mapping Lists.............................................................................................................................................26 3.7. Joining Lists and Splitting Strings...............................................................................................................28 3.8. Summary.....................................................................................................................................................29 Chapter 4. The Power Of Introspection......................................................................................................................31 4.1. Diving In.....................................................................................................................................................31 4.2. Using Optional and Named Arguments.......................................................................................................32 4.3. Using type, str, dir, and Other Built−In Functions......................................................................................33 4.4. Getting Object References With getattr.......................................................................................................36 4.5. Filtering Lists..............................................................................................................................................38 4.6. The Peculiar Nature of and and or...............................................................................................................39 4.7. Using lambda Functions.............................................................................................................................41 4.8. Putting It All Together................................................................................................................................43 4.9. Summary.....................................................................................................................................................45 Chapter 5. Objects and Object−Orientation...............................................................................................................47 5.1. Diving In.....................................................................................................................................................47 5.2. Importing Modules Using from module import...........................................................................................49 5.3. Defining Classes.........................................................................................................................................50 5.4. Instantiating Classes....................................................................................................................................53 5.5. Exploring UserDict: A Wrapper Class........................................................................................................54 5.6. Special Class Methods................................................................................................................................56 5.7. Advanced Special Class Methods................................................................................................................595.8. Introducing Class Attributes.......................................................................................................................60 5.9. Private Functions........................................................................................................................................62 5.10. Summary...................................................................................................................................................63 Chapter 6. Exceptions and File Handling....................................................................................................................64 6.1. Handling Exceptions...................................................................................................................................64 6.2. Working with File Objects..........................................................................................................................66 6.3. Iterating with for Loops..............................................................................................................................70 6.4. Using sys.modules......................................................................................................................................72 6.5. Working with Directories...........................................................................................................................74 6.6. Putting It All Together................................................................................................................................77 6.7. Summary.....................................................................................................................................................78 Chapter 7. Regular Expressions..................................................................................................................................81 7.1. Diving In.....................................................................................................................................................81 7.2. Case Study: Street Addresses......................................................................................................................81 7.3. Case Study: Roman Numerals.....................................................................................................................83 7.4. Using the {n,m} Syntax..............................................................................................................................85 7.5. Verbose Regular Expressions.....................................................................................................................88 7.6. Case study: Parsing Phone Numbers...........................................................................................................89 7.7. Summary.....................................................................................................................................................93 Chapter 8. HTML Processing......................................................................................................................................94 8.1. Diving in.....................................................................................................................................................94 8.2. Introducing sgmllib.py................................................................................................................................98 8.3. Extracting data from HTML documents....................................................................................................100 8.4. Introducing BaseHTMLProcessor.py........................................................................................................102 8.5. locals and globals......................................................................................................................................104 8.6. Dictionary−based string formatting...........................................................................................................107 8.7. Quoting attribute values............................................................................................................................108 8.8. Introducing dialect.py...............................................................................................................................109 8.9. Putting it all together.................................................................................................................................111 8.10. Summary.................................................................................................................................................113 Chapter 9. XML Processing.......................................................................................................................................115 9.1. Diving in...................................................................................................................................................115 9.2. Packages....................................................................................................................................................121 9.3. Parsing XML.............................................................................................................................................123 9.4. Unicode.....................................................................................................................................................125 9.5. Searching for elements..............................................................................................................................129 9.6. Accessing element attributes.....................................................................................................................131 9.7. Segue.........................................................................................................................................................132 Chapter 10. Scripts and Streams...............................................................................................................................133 10.1. Abstracting input sources........................................................................................................................133 10.2. Standard input, output, and error.............................................................................................................136 10.3. Caching node lookups.............................................................................................................................140 10.4. Finding direct children of a node.............................................................................................................141 10.5. Creating separate handlers by node type.................................................................................................141 ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.