Python Cookbook, 2. Auflage

-
 Python Cookbook, 2. Auflage
Andere Artikel dieses Herstellers

Andere Artikel dieser Kategorie

Kurzbeschreibung

Portable, powerful, and a breeze to use, Python is the popular open source object-oriented programming language used for both standalone programs and scripting applications. It is now being used by an increasing number of major organizations, including NASA and Google.

Sprache: Englisch
Betriebssystem:
CPU:
Hersteller: O'Reilly
Lieferumfang: Buch, 844 Seiten
Lieferzeit: 2 Tage
Unser Preis: € 48,00 (incl. 7% MWSt, netto € 44,86)
ab € 39,50 versandkostenfrei im Inland

Beschreibung

Updated for Python 2.4, The Python Cookbook, 2nd Edition offers a wealth of useful code for all Python programmers, not just advanced practitioners. Like its predecessor, the new edition provides solutions to problems that Python programmers face everyday.

It now includes over 200 recipes that range from simple tasks, such as working with dictionaries and list comprehensions, to complex tasks, such as monitoring a network and building a templating system. This revised version also includes new chapters on topics such as time, money, and metaprogramming.

* Manipulating text

* Searching and sorting

* Working with files and the filesystem

* Object-oriented programming

* Dealing with threads and processes

* System administration

* Interacting with databases

* Creating user interfaces

* Network and web programming

* Processing XML

* Distributed programming

* Debugging and testing

Another advantage of The Python Cookbook, 2nd Edition is its trio of authors--three well-known Python programming experts, who are highly visible on email lists and in newsgroups, and speak often at Python conferences.

With scores of practical examples and pertinent background information, The Python Cookbook, 2nd Edition is the one source you need if you're looking to build efficient, flexible, scalable, and well-integrated systems.

Inhaltsverzeichnis

Preface

Part I. The Beginning

1. Introducing Python

     "And Now for Something Completely Different"

     Python Philosophy 101

     The Life of Python

     Signs of the Python Times

     The Compulsory Features List

     What's Python Good For?

     What's Python Not Good For?

     Truth in Advertising

2. A Sneak Preview

The Short Story"

     The Task

Representing Records

Storing Records Persistently

Stepping Up to OOP

Adding Console Interaction

Adding a GUI

Adding a Web Interface

     The End of the Demo

Part II. System Programming

3. System Tools

     "The os.path to Knowledge"

     System Scripting Overview

     Introducing the sys Module

     Introducing the os Module

     Script Execution Context

     Current Working Directory

     Command-Line Arguments

     Shell Environment Variables

     Standard Streams

4. File and Directory Tools

     "Erase Your Hard Drive in Five Easy Steps!"

     File Tools

     Directory Tools

5. Parallel System Tools

     "Telling the Monkeys What to Do"

     Forking Processes

     Threads

     Program Exits

     Interprocess Communication

     Pipes

     Signals

     Other Ways to Start Programs

     A Portable Program-Launch Framework

     Other System Tools

Utilities

     "Splits and Joins and Alien Invasions"

     Splitting and Joining Files

     Generating Forward-Link Web Pages

     A Regression Test Script

     Packing and Unpacking Files

     Automated Program Launchers

Directories

     "The Greps of Wrath"

     Fixing DOS Line Ends

     Fixing DOS Filenames

     Searching Directory Trees

Walking Trees Generically

     Copying Directory Trees

     Deleting Directory Trees

     Comparing Directory Trees

Part III. GUI Programming

8. Graphical User Interfaces

     "Here's Looking at You, Kid"

     Python GUI Development Options

     Tkinter Overview

     Climbing the GUI Learning Curve

     Tkinter Coding Basics

     Tkinter Coding Alternatives

     Adding Buttons and Callbacks

     Adding User-Defined Callback Handlers

     Adding Multiple Widgets

     Customizing Widgets with Classes

     Reusable GUI Components with Classes

     The End of the Tutorial

     Python/Tkinter for Tcl/Tk Converts

9. A Tkinter Tour, Part 1

     "Widgets and Gadgets and GUIs, Oh My!"

     Configuring Widget Appearance

     Top-Level Windows

     Dialogs

     Binding Events

     Message and Entry

     Checkbutton, Radiobutton, and Scale

     Running GUI Code Three Ways

     Images

     Viewing and Processing Images with PIL

10. A Tkinter Tour, Part 2

Spam, Spam, and Spam"

     Menus

     Listboxes and Scrollbars

     Text

     Canvas

     Grids

     Time Tools, Threads, and Animation

     The End of the Tour

     The PyDemos and PyGadgets Launchers

11. GUI Coding Techniques

     "Building a Better Mouse Trap"

Common Tool Mixin Classes

Automating Menus and Toolbars

GUIs for Command-Line Tools

Redirecting Streams to Widgets

     Reloading Callback Handlers Dynamically

     Wrapping Up Top-Level Window Interfaces

     GUIs, Threads, and Queues

     More Ways to Add GUIs to Non-GUI Code

12. Complete GUI Programs

     "Python, Open Source, and Camaros"

A Text Editor Program/Object

An Image Viewer and Resizer

An Image and Notes Slideshow

Painting and Moving Graphics

An Analog/Digital Clock Widget

A Tic-Tac-Toe Game Widget

     Where to Go from Here

Part IV. Internet Programming

13. Network Scripting

     "Tune In, Log On, and Drop Out"

     Plumbing the Internet

     Socket Programming

     Handling Multiple Clients

     A Simple Python File Server

14. Client-Side Scripting

     "Socket to Me!"

Transferring Files over the Net

     Processing Internet Email

Fetching Email

Sending Email

Parsing and Composing Mails

A Console-Based Email Client

     The mailtools Utility Package

Accessing Newsgroups

Accessing Web Sites

     Module urllib Revisited

     Other Client-Side Scripting Options

15. The PyMailGUI Client

     "Use the Source, Luke"

     A PyMailGUI Demo

     PyMailGUI Implementation

16. Server-Side Scripting

     "Oh What a Tangled Web We Weave"

     What's a Server-Side CGI Script?

     Running Server-Side Examples

     Climbing the CGI Learning Curve

     Saving State Information in CGI Scripts

     The Hello World Selector

     Refactoring Code for Maintainability

     More on HTML and URL Escapes

     Transferring Files to Clients and Servers

17. The PyMailCGI Server

     "Things to Do When Visiting Chicago"

     The PyMailCGI Web Site

     The Root Page

     Sending Mail by SMTP

     Reading POP Email

     Processing Fetched Mail

     Utility Modules

     CGI Script Trade-Offs

18. Advanced Internet Topics

     "Surfing on the Shoulders of Giants"

A Web Application Framework

Web Pages from Objects

Python for Java

A Python-Based Web Browser

     XML Processing Tools

     Windows Web Scripting Extensions

     Python Server Pages

     Rolling Your Own Servers in Python

     And Other Cool Stuff

Part V. Tools and Techniques

19. Databases and Persistence

     "Give Me an Order of Persistence, but Hold the Pickles"

     Persistence Options in Python

     DBM Files

     Pickled Objects

     Shelve Files

     The ZODB Object-Oriented Database

     SQL Database Interfaces

A Persistent Object Viewer

20. Data Structures

     "Roses Are Red, Violets Are Blue; Lists Are Mutable, and So Is Set Foo"

     Implementing Stacks

     Implementing Sets

     Subclassing Built-In Types

     Binary Search Trees

     Graph Searching

     Reversing Sequences

     Permuting Sequences

     Sorting Sequences

     Data Structures Versus Python Built-Ins

A Generic Tree Object Viewer

21. Text and Language

     "See Jack Hack. Hack, Jack, Hack"

     Strategies for Parsing Text in Python

     String Method Utilities

     Regular Expression Pattern Matching

     Advanced Language Tools

     Handcoded Parsers

A Calculator Program/Object

Part VI. Integration

22. Extending Python

     "I Am Lost at C"

     Integration Modes

     C Extensions Overview

     A Simple C Extension Module

     Extension Module Details

     The SWIG Integration Code Generator

     Wrapping C Environment Calls

     A C Extension Module String Stack

     A C Extension Type String Stack

     Wrapping C++ Classes with SWIG

     Other Extending Tools

23. Embedding Python

     "Add Python. Mix Well. Repeat."

     C Embedding API Overview

     Basic Embedding Techniques

     Registering Callback Handler Objects

     Using Python Classes in C

ppembed

     Other Integration Topics

Part VII. The End

Python and the Development Cycle

     "That's the End of the Book, Now Here's the Meaning of Life"

     "Something's Wrong with the Way We Program Computers"

     The "Gilligan Factor"

     Doing the Right Thing

     Enter Python

     But What About That Bottleneck?

     On Sinking the Titanic

The Sequel"?

     In the Final Analysis . . .

     Postscript to the Second Edition (2000)

     Postscript to the Third Edition (2006)

Index