Beginning Python®: Using Python 2.6 and Python 3.1

Book description

Beginning Python: Using Python 2.6 and Python 3.1 introduces this open source, portable, interpreted, object-oriented programming language that combines remarkable power with clear syntax. This book enables you to quickly create robust, reliable, and reusable Python applications by teaching the basics so you can quickly develop Web and scientific applications, incorporate databases, and master systems tasks on various operating systems, including Linux, MAC OS, and Windows. You'll get a comprehensive tutorial that guides you from writing simple, basic Python scripts all the way through complex concepts, and also features a reference of the standard modules with examples illustrating how to implement features in the various modules. Plus, the book covers using Python in specific program development domains, such as XML, databases, scientific applications, network programming, and Web development.

Table of contents

  1. Copyright
  2. About the Author
  3. Credits
  4. Acknowledgments
  5. Introduction
    1. Who This Book Is For
    2. What This Book Covers
    3. How This Book Is Structured
      1. Part I — Dipping Your Toe into Python
        1. Programming Basics and Strings
        2. Numbers and Operators
        3. Variables — Names for Values
      2. Part II — Python Language and the Standard Library
        1. Making Decisions
        2. Functions
        3. Classes and Objects
        4. Organizing Programs
        5. Files and Directories
        6. Other Features of the Language
        7. Building a Module
        8. Text Processing
      3. Part III — Putting Python to Work
        1. Testing
        2. Writing a GUI with Python
        3. Accessing Databases
        4. Using Python for XML
        5. Network Programming
        6. Extension Programming with C
        7. Numerical Programming
        8. An Introduction to Django
        9. Web Applications and Web Services
        10. Integrating Java with Python
      4. Part IV: Appendices
    4. What You Need to Use This Book
    5. Conventions
    6. Source Code
    7. Errata
    8. p2p.wrox.com
  6. I. Dipping Your Toe into Python
    1. 1. Programming Basics and Strings
      1. 1.1. How Programming is Different from Using a Computer
        1. 1.1.1. Programming is Consistency
        2. 1.1.2. Programming is Control
        3. 1.1.3. Programming Copes with Change
        4. 1.1.4. What All That Means Together
      2. 1.2. The First Steps
        1. 1.2.1. Installing Python 3.1 on Non-Windows Systems
        2. 1.2.2. Using the Python Shell
      3. 1.3. Beginning to Use Python — Strings
        1. 1.3.1. What is a String?
        2. 1.3.2. Why the Quotes?
        3. 1.3.3. Why Three Types of Quotes?
        4. 1.3.4. Using the print() Function
        5. 1.3.5. Understanding Different Quotes
      4. 1.4. Putting Two Strings Together
        1. 1.4.1. Joining Strings with the Print() Function
      5. 1.5. Putting Strings Together in Different Ways
      6. 1.6. Summary
      7. 1.7. Exercises
    2. 2. Numbers and Operators
      1. 2.1. Different Kinds of Numbers
        1. 2.1.1. Numbers in Python
      2. 2.2. Program Files
        1. 2.2.1. Using the Different Types
        2. 2.2.2. Basic Math
        3. 2.2.3. Some Surprises
      3. 2.3. Using Numbers
        1. 2.3.1. Order of Evaluation
        2. 2.3.2. Number Formats
        3. 2.3.3. Mistakes Will Happen
        4. 2.3.4. Some Unusual Cases
      4. 2.4. Summary
      5. 2.5. Exercises
    3. 3. Variables — Names for Values
      1. 3.1. Referring to Data — Using Names for Data
        1. 3.1.1. Changing Data Through Names
        2. 3.1.2. Copying Data
        3. 3.1.3. Names You Can't Use and Some Rules
      2. 3.2. Using More Built-in Types
        1. 3.2.1. Tuples — Unchanging Sequences of Data
        2. 3.2.2. Lists — Changeable Sequences of Data
        3. 3.2.3. Dictionaries — Groupings of Data Indexed by Name
        4. 3.2.4. Treating a String Like a List
        5. 3.2.5. Special Types
      3. 3.3. Other Common Sequence Properties
        1. 3.3.1. Referencing the Last Elements
        2. 3.3.2. Ranges of Sequences
        3. 3.3.3. Growing Lists by Appending Sequences
        4. 3.3.4. Using Lists to Temporarily Store Data
        5. 3.3.5. Working with Sets
      4. 3.4. Summary
      5. 3.5. Exercises
  7. II. Python Language and the Standard Library
    1. 4. Making Decisions
      1. 4.1. Comparing Values — Are They the Same?
      2. 4.2. Doing the Opposite — Not Equal
      3. 4.3. Comparing Values — Which One Is More?
        1. 4.3.1. More Than or Equal, Less Than or Equal
      4. 4.4. Reversing True and False
      5. 4.5. Looking for the Results of More Than One Comparison
        1. 4.5.1. How to Get Decisions Made
      6. 4.6. Repetition
        1. 4.6.1. How to Do Something — Again and Again
        2. 4.6.2. Stopping the Repetition
      7. 4.7. Handling Errors
        1. 4.7.1. Trying Things Out
      8. 4.8. Summary
      9. 4.9. Exercises
    2. 5. Functions
      1. 5.1. Putting Your Program into Its Own File
      2. 5.2. Functions: Grouping Code under a Name
        1. 5.2.1. Choosing a Name
        2. 5.2.2. Describing a Function in the Function
        3. 5.2.3. The Same Name in Two Different Places
        4. 5.2.4. Making Notes to Yourself
        5. 5.2.5. Asking a Function to Use a Value You Provide
        6. 5.2.6. Checking Your Parameters
        7. 5.2.7. Setting a Default Value for a Parameter — Just in Case
        8. 5.2.8. Calling Functions from within Other Functions
        9. 5.2.9. Functions Inside of Functions
        10. 5.2.10. Flagging an Error on Your Own Terms
      3. 5.3. Layers of Functions
        1. 5.3.1. How to Read Deeper Errors
      4. 5.4. Summary
      5. 5.5. Exercises
    3. 6. Classes and Objects
      1. 6.1. Thinking About Programming
        1. 6.1.1. What is an Object?
        2. 6.1.2. Objects You Already Know
        3. 6.1.3. Looking Ahead: How You Want to Use Objects
      2. 6.2. Defining a Class
        1. 6.2.1. How Code Can Be Made into an Object
        2. 6.2.2. Objects and Their Scope
      3. 6.3. Summary
      4. 6.4. Exercises
    4. 7. Organizing Programs
      1. 7.1. Modules
        1. 7.1.1. Importing a Module So That You Can Use It
        2. 7.1.2. Making a Module from Pre-existing Code
        3. 7.1.3. Using Modules — Starting with the Command Line
        4. 7.1.4. Changing How Import Works — Bringing in More
      2. 7.2. Packages
      3. 7.3. Modules and Packages
        1. 7.3.1. Bringing Everything into the Current Scope
        2. 7.3.2. Re-importing Modules and Packages
      4. 7.4. Basics of Testing Your Modules and Packages
      5. 7.5. Summary
      6. 7.6. Exercises
    5. 8. Files and Directories
      1. 8.1. File Objects
        1. 8.1.1. Writing Text Files
        2. 8.1.2. Appending Text to a File
        3. 8.1.3. Reading Text Files
        4. 8.1.4. File Exceptions
      2. 8.2. Paths and Directories
      3. 8.3. Exceptions in os
        1. 8.3.1. Paths
        2. 8.3.2. Directory Contents
        3. 8.3.3. Obtaining Information about Files
          1. 8.3.3.1. Recursive Directory Listings
        4. 8.3.4. Renaming, Moving, Copying, and Removing Files
        5. 8.3.5. Example: Rotating Files
        6. 8.3.6. Creating and Removing Directories
        7. 8.3.7. Globbing
      4. 8.4. Summary
      5. 8.5. Exercises
    6. 9. Other Features of the Language
      1. 9.1. Lambda and Filter: Short Anonymous Functions
      2. 9.2. Map: Short-Circuiting Loops
      3. 9.3. Decisions within Lists — List Comprehension
      4. 9.4. Generating Iterators for Loops
      5. 9.5. Special String Substitution Using Dictionaries
      6. 9.6. Featured Modules
        1. 9.6.1. Getopt — Getting Options from the Command Line
        2. 9.6.2. Using More Than One Process
        3. 9.6.3. Threads — Doing Many Things in the Same Process
      7. 9.7. Summary
      8. 9.8. Exercises
    7. 10. Building a Module
      1. 10.1. Exploring Modules
        1. 10.1.1. Importing Modules
        2. 10.1.2. Finding Modules
        3. 10.1.3. Digging through Modules
      2. 10.2. Creating Modules and Packages
      3. 10.3. Working with Classes
        1. 10.3.1. Defining Object-Oriented Programming
        2. 10.3.2. Creating Classes
        3. 10.3.3. Extending Existing Classes
      4. 10.4. Finishing Your Modules
        1. 10.4.1. Defining Module-Specific Errors
        2. 10.4.2. Choosing What to Export
        3. 10.4.3. Documenting Your Modules
        4. 10.4.4. Testing Your Module
        5. 10.4.5. Running a Module as a Program
      5. 10.5. Creating a Whole Module
      6. 10.6. Installing Your Modules
      7. 10.7. Summary
      8. 10.8. Exercises
    8. 11. Text Processing
      1. 11.1. Why Text Processing Is So Useful
        1. 11.1.1. Searching for Files
        2. 11.1.2. Clipping Logs
        3. 11.1.3. Sifting through Mail
      2. 11.2. Navigating the File System with the os Module
      3. 11.3. Working with Regular Expressions and the re Module
      4. 11.4. Summary
      5. 11.5. Exercises
  8. III. Putting Python to Work
    1. 12. Testing
      1. 12.1. Assertions
      2. 12.2. Test Cases and Test Suites
      3. 12.3. Test Fixtures
      4. 12.4. Putting It All Together with Extreme Programming
        1. 12.4.1. Implementing a Search Utility in Python
        2. 12.4.2. A More Powerful Python Search
      5. 12.5. Formal Testing in the Software Life Cycle
      6. 12.6. Summary
    2. 13. Writing a GUI with Python
      1. 13.1. GUI Programming Toolkits for Python
      2. 13.2. Tkinter Introduction
      3. 13.3. Creating GUI Widgets with Tkinter
        1. 13.3.1. Resizing the Widget
        2. 13.3.2. Configuring Widget Options
        3. 13.3.3. Putting the Widgets to Work
        4. 13.3.4. Creating Layouts
        5. 13.3.5. Packing Order
        6. 13.3.6. Controlling Widget Appearances
        7. 13.3.7. Radio Buttons and Checkboxes
        8. 13.3.8. Dialog Boxes
        9. 13.3.9. Other Widget Types
      4. 13.4. Summary
      5. 13.5. Exercises
    3. 14. Accessing Databases
      1. 14.1. Working with DBM Persistent Dictionaries
        1. 14.1.1. Choosing a DBM Module
        2. 14.1.2. Creating Persistent Dictionaries
        3. 14.1.3. Accessing Persistent Dictionaries
        4. 14.1.4. Deciding When to Use DBM and When to Use a Relational Database
      2. 14.2. Working with Relational Databases
        1. 14.2.1. Writing SQL Statements
        2. 14.2.2. Defining Tables
        3. 14.2.3. Setting Up a Database
      3. 14.3. Using the Python Database APIs
        1. 14.3.1. Downloading Modules
        2. 14.3.2. Creating Connections
        3. 14.3.3. Working with Cursors
        4. 14.3.4. Working with Transactions and Committing the Results
        5. 14.3.5. Examining Module Capabilities and Metadata
        6. 14.3.6. Handling Errors
      4. 14.4. Summary
      5. 14.5. Exercises
    4. 15. Using Python for XML
      1. 15.1. What Is XML?
        1. 15.1.1. A Hierarchical Markup Language
        2. 15.1.2. A Family of Standards
      2. 15.2. What Is a Schema/DTD?
        1. 15.2.1. What Are Document Models For?
        2. 15.2.2. Do You Need One?
      3. 15.3. Document Type Definitions
        1. 15.3.1. An Example DTD
        2. 15.3.2. DTDs Aren't Exactly XML
        3. 15.3.3. Limitations of DTDs
      4. 15.4. Schemas
        1. 15.4.1. An Example Schema
        2. 15.4.2. Schemas Are Pure XML
        3. 15.4.3. Schemas Are Hierarchical
        4. 15.4.4. Other Advantages of Schemas
      5. 15.5. XPath
      6. 15.6. HTML as a Subset of XML
        1. 15.6.1. The HTML DTDs
        2. 15.6.2. HTMLParser
      7. 15.7. XML Libraries Available for Python
      8. 15.8. What Is SAX?
        1. 15.8.1. Stream-based
        2. 15.8.2. Event-driven
        3. 15.8.3. What Is DOM?
        4. 15.8.4. In-memory Access
      9. 15.9. Why Use SAX or DOM
        1. 15.9.1. Capability Trade-Offs
        2. 15.9.2. Memory Considerations
        3. 15.9.3. Speed Considerations
      10. 15.10. SAX and DOM Parsers Available for Python
        1. 15.10.1. xml.sax
        2. 15.10.2. xml.dom.minidom
      11. 15.11. Intro to XSLT
        1. 15.11.1. XSLT Is XML
        2. 15.11.2. Transformation and Formatting Language
        3. 15.11.3. Functional, Template-Driven
      12. 15.12. What Is lxml?
      13. 15.13. Element Classes
        1. 15.13.1. Adding Text to Elements
      14. 15.14. Parsing with lxml
        1. 15.14.1. Parsing Files
      15. 15.15. Summary
      16. 15.16. Exercises
    5. 16. Network Programming
      1. 16.1. Understanding Protocols
        1. 16.1.1. Comparing Protocols and Programming Languages
        2. 16.1.2. The Internet Protocol Stack
        3. 16.1.3. A Little Bit About the Internet Protocol
          1. 16.1.3.1. Internet Addresses
          2. 16.1.3.2. Internet Ports
      2. 16.2. Sending Internet E-mail
        1. 16.2.1. The E-mail File Format
        2. 16.2.2. MIME Messages
          1. 16.2.2.1. MIME Encodings: Quoted-printable and Base64
          2. 16.2.2.2. MIME Content Types
          3. 16.2.2.3. MIME Multipart Messages
        3. 16.2.3. Sending Mail with SMTP and smtplib
      3. 16.3. Retrieving Internet E-mail
        1. 16.3.1. Parsing a Local Mail Spool with mailbox
        2. 16.3.2. Fetching Mail from a POP3 Server with poplib
        3. 16.3.3. Fetching Mail from an IMAP Server with imaplib
          1. 16.3.3.1. IMAP's Unique Message IDs
        4. 16.3.4. Secure POP3 and IMAP
        5. 16.3.5. Webmail Applications Are Not E-mail Applications
      4. 16.4. Socket Programming
        1. 16.4.1. Introduction to Sockets
        2. 16.4.2. Binding to an External Hostname
        3. 16.4.3. The Mirror Server
        4. 16.4.4. The Mirror Client
        5. 16.4.5. SocketServer
        6. 16.4.6. Multithreaded Servers
        7. 16.4.7. The Python Chat Server
        8. 16.4.8. Design of the Python Chat Server
        9. 16.4.9. The Python Chat Server Protocol
          1. 16.4.9.1. Your Hypothetical Protocol in Action
          2. 16.4.9.2. Initial Connection
          3. 16.4.9.3. Chat Text
          4. 16.4.9.4. Server Commands
          5. 16.4.9.5. General Guidelines
        10. 16.4.10. The Python Chat Client
        11. 16.4.11. Single-Threaded Multitasking with select
      5. 16.5. Other Topics
        1. 16.5.1. Miscellaneous Considerations for Protocol Design
          1. 16.5.1.1. Trusted Servers
          2. 16.5.1.2. Terse Protocols
        2. 16.5.2. The Peer-to-Peer Architecture
      6. 16.6. Summary
      7. 16.7. Exercises
    6. 17. Extension Programming with C
      1. 17.1. Extension Module Outline
      2. 17.2. Building and Installing Extension Modules
      3. 17.3. Passing Parameters from Python to C
      4. 17.4. Returning Values from C to Python
      5. 17.5. The LAME Project
      6. 17.6. The LAME Extension Module
      7. 17.7. Using Python Objects from C Code
      8. 17.8. Summary
      9. 17.9. Exercises
    7. 18. Numerical Programming
      1. 18.1. Numbers in Python
        1. 18.1.1. Integers
        2. 18.1.2. Long Integers
        3. 18.1.3. Floating-point Numbers
        4. 18.1.4. Formatting Numbers
        5. 18.1.5. Characters as Numbers
      2. 18.2. Mathematics
        1. 18.2.1. Arithmetic
        2. 18.2.2. Built-in Math Functions
      3. 18.3. Complex Numbers
      4. 18.4. Arrays
        1. 18.4.1. The Array Module
      5. 18.5. Summary
      6. 18.6. Exercises
    8. 19. An Introduction to Django
      1. 19.1. What Are Frameworks and Why Would I Use One?
      2. 19.2. Other Features of Web Frameworks
      3. 19.3. Django — How It All Began
        1. 19.3.1. Installing Django
      4. 19.4. Understanding Django's Architecture
        1. 19.4.1. Initial Project Setup
        2. 19.4.2. Creating a View
      5. 19.5. Working with Templates
      6. 19.6. Using Templates and Views
        1. 19.6.1. Models
        2. 19.6.2. Creating a Model: First Steps — Configure the Database Settings
      7. 19.7. Creating a Model: Creating an Application
        1. 19.7.1. Working with Models: Installation
      8. 19.8. Summary
      9. 19.9. Exercises
    9. 20. Web Applications and Web Services
      1. 20.1. REST: The Architecture of the Web
        1. 20.1.1. Characteristics of REST
          1. 20.1.1.1. A Distributed Network of Interlinked Documents
          2. 20.1.1.2. A Client-Server Architecture
          3. 20.1.1.3. Servers Are Stateless
          4. 20.1.1.4. Resources
          5. 20.1.1.5. Representations
        2. 20.1.2. REST Operations
      2. 20.2. HTTP: Real-World REST
        1. 20.2.1. The Visible Web Server
        2. 20.2.2. The HTTP Request
        3. 20.2.3. The HTTP Response
      3. 20.3. CGI: Turning Scripts into Web Applications
        1. 20.3.1. The Web Server Makes a Deal with the CGI Script
        2. 20.3.2. CGI's Special Environment Variables
        3. 20.3.3. Accepting User Input through HTML Forms
      4. 20.4. HTML Forms' Limited Vocabulary
        1. 20.4.1. The cgi Module: Parsing HTML Forms
      5. 20.5. Safety When Accessing Form Values
      6. 20.6. Building a Wiki
        1. 20.6.1. The BittyWiki Core Library
          1. 20.6.1.1. Back-end Storage
          2. 20.6.1.2. WikiWords
          3. 20.6.1.3. Writing the BittyWiki Core
        2. 20.6.2. The BittyWiki Web Interface
          1. 20.6.2.1. Resources
          2. 20.6.2.2. Request Structure
          3. 20.6.2.3. But Wait — There's More (Resources)
          4. 20.6.2.4. Wiki Markup
      7. 20.7. Web Services
        1. 20.7.1. How Web Services Work
      8. 20.8. REST Web Services
        1. 20.8.1. REST Quick Start: Finding Bargains on Amazon.com
        2. 20.8.2. Introducing WishListBargainFinder
        3. 20.8.3. Giving BittyWiki a REST API
        4. 20.8.4. Wiki Search-and-Replace Using the REST Web Service
      9. 20.9. XML-RPC
        1. 20.9.1. The XML-RPC Request
          1. 20.9.1.1. Representation of Data in XML-RPC
        2. 20.9.2. The XML-RPC Response
        3. 20.9.3. If Something Goes Wrong
        4. 20.9.4. Exposing the BittyWiki API through XML-RPC
        5. 20.9.5. Wiki Search-and-Replace Using the XML-RPC Web Service
      10. 20.10. SOAP
        1. 20.10.1. SOAP Quick Start
        2. 20.10.2. The SOAP Request
        3. 20.10.3. The SOAP Response
        4. 20.10.4. If Something Goes Wrong
        5. 20.10.5. Exposing a SOAP Interface to BittyWiki
        6. 20.10.6. Wiki Search-and-Replace Using the SOAP Web Service
      11. 20.11. Documenting Your Web Service API
        1. 20.11.1. Human-Readable API Documentation
          1. 20.11.1.1. The BittyWiki REST API Document
          2. 20.11.1.2. The BittyWiki XML-RPC API Document
          3. 20.11.1.3. The BittyWiki SOAP API Document
        2. 20.11.2. The XML-RPC Introspection API
        3. 20.11.3. WSDL
      12. 20.12. Choosing a Web Service Standard
      13. 20.13. Web Service Etiquette
        1. 20.13.1. For Consumers of Web Services
        2. 20.13.2. For Producers of Web Services
        3. 20.13.3. Using Web Applications as Web Services
      14. 20.14. Summary
      15. 20.15. Exercises
    10. 21. Integrating Java with Python
      1. 21.1. Scripting within Java Applications
      2. 21.2. Comparing Python Implementations
      3. 21.3. Installing Jython
      4. 21.4. Running Jython
        1. 21.4.1. Running Jython Interactively
        2. 21.4.2. Running Jython Scripts
        3. 21.4.3. Controlling the jython Script
        4. 21.4.4. Making Executable Commands
      5. 21.5. Running Jython on Your Own
      6. 21.6. Packaging Jython-Based Applications
      7. 21.7. Integrating Java and Jython
        1. 21.7.1. Using Java Classes in Jython
        2. 21.7.2. Accessing Databases from Jython
          1. 21.7.2.1. Working with the Python DB API
          2. 21.7.2.2. Setting Up a Database
        3. 21.7.3. Writing Java EE Servlets in Jython
          1. 21.7.3.1. Setting Up an Application Server
          2. 21.7.3.2. Adding the PyServlet to an Application Server
          3. 21.7.3.3. Extending HttpServlet
        4. 21.7.4. Choosing Tools for Jython
      8. 21.8. Testing from Jython
      9. 21.9. Embedding the Jython Interpreter
        1. 21.9.1. Calling Jython Scripts from Java
      10. 21.10. Handling Differences between C-Python and Jython
      11. 21.11. Summary
      12. 21.12. Exercises
  9. IV. Appendices
    1. A. Answers to the Exercises
      1. A.1. Chapter 1
        1. A.1.1. Exercise 1 Solution
        2. A.1.2. Exercise 2 Solution
      2. A.2. Chapter 2
        1. A.2.1. Exercise 1 Solution
        2. A.2.2. Exercise 2 Solution
        3. A.2.3. Exercise 3 Solution
        4. A.2.4. Exercise 4 Solution
      3. A.3. Chapter 3
        1. A.3.1. Exercise 1 Solution
        2. A.3.2. Exercise 2 Solution
        3. A.3.3. Exercise 3 Solution
        4. A.3.4. Exercise 4 Solution
        5. A.3.5. Exercise 5 Solution
        6. A.3.6. Exercise 6 Solution
        7. A.3.7. Exercise 7 Solution
        8. A.3.8. Exercise 8 Solution
        9. A.3.9. Exercise 9 Solution
        10. A.3.10. Exercise 10 Solution
      4. A.4. Chapter 4
        1. A.4.1. Exercise 1 Solution
        2. A.4.2. Exercise 2 Solution
        3. A.4.3. Exercise 3 Solution
        4. A.4.4. Exercise 4 Solution
        5. A.4.5. Exercise 5 Solution
        6. A.4.6. Exercise 6 Solution
      5. A.5. Chapter 5
        1. A.5.1. Exercise 1 Solution
        2. A.5.2. Exercise 2 Solution
        3. A.5.3. Exercise 3 Solution
        4. A.5.4. Exercise 4 Solution
      6. A.6. Chapter 6
        1. A.6.1. Exercise 1 Solution
        2. A.6.2. Exercise 2 Solution
        3. A.6.3. Exercise 3 Solution
        4. A.6.4. Exercise 4 Solution
        5. A.6.5. Exercise 5 Solution
        6. A.6.6. Exercise 6 Solution
      7. A.7. Chapter 7
        1. A.7.1. Exercise 1 Solution
        2. A.7.2. Exercise 2 Solution
        3. A.7.3. Exercise 3 Solution
      8. A.8. Chapter 8
        1. A.8.1. Exercise 1 Solution
        2. A.8.2. Exercise 2 Solution
      9. A.9. Chapter 9
      10. A.10. Chapter 10
        1. A.10.1. Exercise 1 Solution
        2. A.10.2. Exercise 2 Solution
        3. A.10.3. Exercise 3 Solution
        4. A.10.4. Exercise 4 Solution
        5. A.10.5. Exercise 5 Solution
      11. A.11. Chapter 11
        1. A.11.1. Exercise 1 Solution
        2. A.11.2. Exercise 2 Solution
        3. A.11.3. Exercise 3 Solution
      12. A.12. Chapter 13
      13. A.13. Chapter 14
        1. A.13.1. Exercise 1 Solution
        2. A.13.2. Exercise 2 Solution
        3. A.13.3. Exercise 3 Solution
      14. A.14. Chapter 15
        1. A.14.1. Exercise 1 Solution
        2. A.14.2. Exercise 2 Solution
        3. A.14.3. Exercise 3 Solution
      15. A.15. Chapter 16
        1. A.15.1. Exercise 1 Solution
        2. A.15.2. Exercise 2 Solution
        3. A.15.3. Exercise 3 Solution
        4. A.15.4. Exercise 4 Solution
        5. A.15.5. Exercise 5 Solution
      16. A.16. Chapter 17
      17. A.17. Chapter 18
        1. A.17.1. Exercise 1 Solution
        2. A.17.2. Exercise 2 Solution
        3. A.17.3. Exercise 3 Solution
      18. A.18. Chapter 19
      19. A.19. Chapter 20
        1. A.19.1. Exercise 1 Solution
        2. A.19.2. Exercise 2 Solution
        3. A.19.3. Exercise 3 Solution
        4. A.19.4. Exercise 4 Solution
        5. A.19.5. Exercise 5 Solution
      20. A.20. Chapter 21
        1. A.20.1. Exercise 1 Solution
        2. A.20.2. Exercise 2 Solution
        3. A.20.3. Exercise 3 Solution
        4. A.20.4. Exercise 4 Solution
        5. A.20.5. Exercise 5 Solution
    2. B. Online Resources
      1. B.1. Software
      2. B.2. For More Information
    3. C. What's New in Python 3.1
      1. C.1. Print Is Now a Function
      2. C.2. Certain APIs Return Views and Iterators
      3. C.3. Integers
      4. C.4. Unicode and 8-bit
      5. C.5. Exceptions
      6. C.6. Classes
      7. C.7. Comparisons, Operators, and Methods
      8. C.8. Syntactical Changes
      9. C.9. Packages and Modules
      10. C.10. Builtins
      11. C.11. The 2to3 Tool
    4. D. Glossary

Product information

  • Title: Beginning Python®: Using Python 2.6 and Python 3.1
  • Author(s): James Payne
  • Release date: February 2010
  • Publisher(s): Wrox
  • ISBN: 9780470414637