Dive into python3

Table of Contents

  1. What’s New in “Dive Into Python 3”

    1. a.k.a. “the minus level”
  2. Installing Python
    1. Diving In
    2. Which Python Is Right For You?
    3. Installing on Microsoft Windows
    4. Installing on Mac OS X
    5. Installing on Ubuntu Linux
    6. Installing on Other Platforms
    7. Using The Python Shell
    8. Python Editors and IDEs
  3. Your First Python Program
    1. Diving In
    2. Declaring Functions
      1. Optional and Named Arguments
    3. Writing Readable Code
      1. Documentation Strings
    4. The import Search Path
    5. Everything Is An Object
      1. What’s An Object?
    6. Indenting Code
    7. Exceptions
      1. Catching Import Errors
    8. Unbound Variables
    9. Everything is Case-Sensitive
    10. Running Scripts
    11. Further Reading
  4. Native Datatypes
    1. Diving In
    2. Booleans
    3. Numbers
      1. Coercing Integers To Floats And Vice-Versa
      2. Common Numerical Operations
      3. Fractions
      4. Trigonometry
      5. Numbers In A Boolean Context
    4. Lists
      1. Creating A List
      2. Slicing A List
      3. Adding Items To A List
      4. Searching For Values In A List
      5. Removing Items From A List
      6. Removing Items From A List: Bonus Round
      7. Lists In A Boolean Context
    5. Tuples
      1. Tuples In A Boolean Context
      2. Assigning Multiple Values At Once
    6. Sets
      1. Creating A Set
      2. Modifying A Set
      3. Removing Items From A Set
      4. Common Set Operations
      5. Sets In A Boolean Context
    7. Dictionaries
      1. Creating A Dictionary
      2. Modifying A Dictionary
      3. Mixed-Value Dictionaries
      4. Dictionaries In A Boolean Context
    8. None
      1. None In A Boolean Context
    9. Further Reading
  5. Comprehensions
    1. Diving In
    2. Working With Files And Directories
      1. The Current Working Directory
      2. Working With Filenames and Directory Names
      3. Listing Directories
      4. Getting File Metadata
      5. Constructing Absolute Pathnames
    3. List Comprehensions
    4. Dictionary Comprehensions
      1. Other Fun Stuff To Do With Dictionary Comprehensions
    5. Set Comprehensions
    6. Further Reading
  6. Strings
    1. Some Boring Stuff You Need To Understand Before You Can Dive In
    2. Unicode
    3. Diving In
    4. Formatting Strings
      1. Compound Field Names
      2. Format Specifiers
    5. Other Common String Methods
      1. Slicing A String
    6. Strings vs. Bytes
    7. Postscript: Character Encoding Of Python Source Code
    8. Further Reading
  7. Regular Expressions
    1. Diving In
    2. Case Study: Street Addresses
    3. Case Study: Roman Numerals
      1. Checking For Thousands
      2. Checking For Hundreds
    4. Using The {n,m} Syntax
      1. Checking For Tens And Ones
    5. Verbose Regular Expressions
    6. Case study: Parsing Phone Numbers
    7. Summary
  8. Closures & Generators
    1. Diving In
    2. I Know, Let’s Use Regular Expressions!
    3. A List Of Functions
    4. A List Of Patterns
    5. A File Of Patterns
    6. Generators
      1. A Fibonacci Generator
      2. A Plural Rule Generator
    7. Further Reading
  9. Classes & Iterators
    1. Diving In
    2. Defining Classes
      1. The __init__() Method
    3. Instantiating Classes
    4. Instance Variables
    5. A Fibonacci Iterator
    6. A Plural Rule Iterator
    7. Further Reading
  10. Advanced Iterators
    1. Diving In
    2. Finding all occurrences of a pattern
    3. Finding the unique items in a sequence
    4. Making assertions
    5. Generator expressions
    6. Calculating Permutations… The Lazy Way!
    7. Other Fun Stuff in the itertools Module
    8. A New Kind Of String Manipulation
    9. Evaluating Arbitrary Strings As Python Expressions
    10. Putting It All Together
    11. Further Reading
  11. Unit Testing
    1. (Not) Diving In
    2. A Single Question
    3. “Halt And Catch Fire”
    4. More Halting, More Fire
    5. And One More Thing…
    6. A Pleasing Symmetry
    7. More Bad Input
  12. Refactoring
    1. Diving In
    2. Handling Changing Requirements
    3. Refactoring
    4. Summary
  13. Files
    1. Diving In
    2. Reading From Text Files
      1. Character Encoding Rears Its Ugly Head
      2. Stream Objects
      3. Reading Data From A Text File
      4. Closing Files
      5. Closing Files Automatically
      6. Reading Data One Line At A Time
    3. Writing to Text Files
      1. Character Encoding Again
    4. Binary Files
    5. Stream Objects From Non-File Sources
      1. Handling Compressed Files
    6. Standard Input, Output, and Error
      1. Redirecting Standard Output
    7. Further Reading
  14. XML
    1. Diving In
    2. A 5-Minute Crash Course in XML
    3. The Structure Of An Atom Feed
    4. Parsing XML
      1. Elements Are Lists
      2. Attributes Are Dictonaries
    5. Searching For Nodes Within An XML Document
    6. Going Further With lxml
    7. Generating XML
    8. Parsing Broken XML
    9. Further Reading
  15. Serializing Python Objects
    1. Diving In

      1. A Quick Note About The Examples in This Chapter
    2. Saving Data to a Pickle File
    3. Loading Data from a Pickle File
    4. Pickling Without a File
    5. Bytes and Strings Rear Their Ugly Heads Again
    6. Debugging Pickle Files
    7. Serializing Python Objects to be Read by Other Languages
    8. Saving Data to a json File
    9. Mapping of Python Datatypes to json
    10. Serializing Datatypes Unsupported by json
    11. Loading Data from a json File
    12. Further Reading
  16. HTTP Web Services
    1. Diving In
    2. Features of HTTP
      1. Caching
      2. Last-Modified Checking
      3. ETag Checking
      4. Compression
      5. Redirects
    3. How Not To Fetch Data Over HTTP
    4. What’s On The Wire?
    5. Introducing httplib2
      1. A Short Digression To Explain Why httplib2 Returns Bytes Instead of Strings
      2. How httplib2 Handles Caching
      3. How httplib2 Handles Last-Modified and ETag Headers
      4. How http2lib Handles Compression
      5. How httplib2 Handles Redirects
    6. Beyond HTTP GET
    7. Beyond HTTP POST
    8. Further Reading
  17. Case Study: Porting chardet to Python 3
    1. Diving In
    2. What is Character Encoding Auto-Detection?
      1. Isn’t That Impossible?
      2. Does Such An Algorithm Exist?
    3. Introducing The chardet Module
      1. utf-n With A bom
      2. Escaped Encodings
      3. Multi-Byte Encodings
      4. Single-Byte Encodings
      5. windows-1252
    4. Running 2to3
    5. A Short Digression Into Multi-File Modules
    6. Fixing What 2to3 Can’t
      1. False is invalid syntax
      2. No module named constants
      3. Name ‘file‘ is not defined
      4. Can’t use a string pattern on a bytes-like object
      5. Can‘t convert ‘bytes‘ object to str implicitly
      6. Unsupported operand type(s) for +: ‘int‘ and ‘bytes‘
      7. ord() expected string of length 1, but int found
      8. Unorderable types: int() >= str()
      9. Global name ‘reduce‘ is not defined
    7. Summary
  18. Packaging Python Libraries
    1. Diving In
    2. Things Distutils Can’t Do For You
    3. Directory Structure
    4. Writing Your Setup Script
    5. Classifying Your Package
      1. Examples of Good Package Classifiers
    6. Specifying Additional Files With A Manifest
    7. Checking Your Setup Script for Errors
    8. Creating a Source Distribution
    9. Creating a Graphical Installer
      1. Building Installable Packages for Other Operating Systems
    10. Adding Your Software to The Python Package Index
    11. The Many Possible Futures of Python Packaging
    12. Further Reading
  19. Porting Code to Python 3 with 2to3
    1. Diving In
    2. print statement
    3. Unicode string literals
    4. unicode() global function
    5. long data type
    6. <> comparison
    7. has_key() dictionary method
    8. Dictionary methods that return lists
    9. Modules that have been renamed or reorganized
      1. http
      2. urllib
      3. dbm
      4. xmlrpc
      5. Other modules
    10. Relative imports within a package
    11. next() iterator method
    12. filter() global function
    13. map() global function
    14. reduce() global function
    15. apply() global function
    16. intern() global function
    17. exec statement
    18. execfile statement
    19. repr literals (backticks)
    20. try...except statement
    21. raise statement
    22. throw method on generators
    23. xrange() global function
    24. raw_input() and input() global functions
    25. func_* function attributes
    26. xreadlines() I/O method
    27. lambda functions that take a tuple instead of multiple parameters
    28. Special method attributes
    29. __nonzero__ special method
    30. Octal literals
    31. sys.maxint
    32. callable() global function
    33. zip() global function
    34. StandardError exception
    35. types module constants
    36. isinstance() global function
    37. basestring datatype
    38. itertools module
    39. sys.exc_typesys.exc_valuesys.exc_traceback
    40. List comprehensions over tuples
    41. os.getcwdu() function
    42. Metaclasses
    43. Matters of style
      1. set() literals (explicit)
      2. buffer() global function (explicit)
      3. Whitespace around commas (explicit)
      4. Common idioms (explicit)
  20. Special Method Names
    1. Diving In
    2. Basics
    3. Classes That Act Like Iterators
    4. Computed Attributes
    5. Classes That Act Like Functions
    6. Classes That Act Like Sets
    7. Classes That Act Like Dictionaries
    8. Classes That Act Like Numbers
    9. Classes That Can Be Compared
    10. Classes That Can Be Serialized
    11. Classes That Can Be Used in a with Block
    12. Really Esoteric Stuff
    13. Further Reading
  21. Where to Go From Here
    1. Things to Read
    2. Where To Look For Python 3-Compatible Code
  22. Troubleshooting
    1. Diving In
    2. Getting to the Command Line
    3. Running Python on the command line

参考:http://www.diveintopython3.net/

时间: 2024-10-15 08:18:10

Dive into python3的相关文章

【编程书籍 大系】 计算机开放电子书汇总

计算机开放电子书汇总 站点 站点源码 100个gcc小技巧 在线阅读 PDF格式 EPUB格式 MOBI格式 100个gdb小技巧 在线阅读 PDF格式 EPUB格式 MOBI格式 关于浏览器和网络的 20 项须知 在线阅读 PDF格式 EPUB格式 MOBI格式 2015互联网企业校招笔试题 MEGA下载 Github下载 3周3页面 在线阅读 PDF格式 EPUB格式 MOBI格式 简明 Python 教程 在线阅读 PDF格式 EPUB格式 A Guide to HTML5 and CSS

python-成长之路

一系列python方面有价值的参考/跟python有关的东西 http://www.path8.net/tn/archives/6017 Tools PyCharm – 来自JetBrains的强大的IDE Python Tools for Visual Studio Eclipse + pydev Aptana Emacs bpython – 界面很友好功能很强大的python shell pybuild – 基于 py2exe 的打包 "python 解释器" 脚本 Web Fra

python技巧31[移植python2.x到3.x]

我们都知道python从2.x升级到3.x的过程中有一些不兼容的改动,但是有时还我们不得不将2.x的程序升级到3.x. 主要不兼容如下图: 移植过程: 1) 确保存在的代码有足够的测试覆盖.从2.x到3.x的升级工作量并不是很大,但是包含了很多的微小的不兼容,必须通过测试来确保升级后的程序仍然保持原有的功能.完全的测试覆盖不是被建议的,但是确实是需要的. 2) 用python 2.6 的 -3 命令行选项来运行程序,从而发现和去除明显的不兼容问题. 3) 使用2to3转化工具来自动地将程序转化为

程序猿的相关

Javascript jQuery Fundamentals - jQuery 新手教程. JavaScript库 代码解构 - 将JavaScript流行框架源码条分缕析展现出来 深入理解Javascript系列 <Script>的defer和async的差别 Javascript面向对象基础 Backbone.js基础 JavaScript Madness: Keyboard Events Let's Make Frameworks 国内公司JS框架:Kissy - Taobao | Ar

很好的计算机相关书籍下载网站----计算机书籍控

计算机书籍控:http://bestcbooks.com/ 转自:http://bestcbooks.com/free-programming-books 英文世界有人整理出史上最全的免费计算机书籍放到了github上:free-programming-books,列表很长,其中的电子书都是作者或者出版社等版权所有人授权公开的. 这里也整理一份中文版的免费(开源或有授权)的计算机书籍列表.虽目前搜寻到的书目不多,但希望列表可以丰满起来,如果有您知道没包含进此列表的,望留言补充. C语言 Linu

【转】Python3.x移除了callable内建函数

原文地址:http://www.cnblogs.com/elvisxu/archive/2010/10/26/1861958.html 最近学习Python的时候,在Python3下跑<Dive Into Python>一个例子,发现在调用callable()函数时报了错误: NameError: name 'callable' is not defined 上网一查发现Python3已经将此内置函数移除了.查阅Python v3.0 documentation发现可以使用 hasattr(o

ubuntu下卸载python2和升级python3.5

卸载python只需一条语句就可以实现 sudu apt-get remove python ubuntu下安装python3 sudo apt-get install python3 但这样只安装了python3.4 要想使用python3.5,则必须升级python3.4 sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update sudo apt-get install python3.5 使用以上三行命令便可升级py

python3 装饰器

看廖雪峰官网的python3装饰器有感 装饰器即将一个函数作为变量在新的函数中调用此函数. 作业: 能否写出一个@log的decorator,使它既支持: @logdef f():     pass 又支持: @log('execute')def f():     pass      例1: import functools import time def log(*args,**kwargs):     # *args 是个元组     if args and isinstance(args,

Python3 - MySQL适配器 PyMySQL

本文我们为大家介绍 Python3 使用 PyMySQL 连接数据库,并实现简单的增删改查. 什么是 PyMySQL? PyMySQL 是在 Python3.x 版本中用于连接 MySQL 服务器的一个库,Python2中则使用mysqldb. PyMySQL 遵循 Python 数据库 API v2.0 规范,并包含了 pure-Python MySQL 客户端库. PyMySQL 安装 在使用 PyMySQL 之前,我们需要确保 PyMySQL 已安装. PyMySQL 下载地址:https