Programming Python

( 5 )


If you've mastered Python's fundamentals, you're ready to start using it to get real work done. Programming Python will show you how, with in-depth tutorials on the language's primary application domains: system administration, GUIs, and the Web. You'll also explore how Python is used in databases, networking, front-end scripting layers, text processing, and more. This book focuses on commonly used tools and libraries to give you a comprehensive understanding of Python’s many ...

See more details below
Paperback (Fourth Edition)
$41.91 price
(Save 35%)$64.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (25) from $20.56   
  • New (15) from $38.70   
  • Used (10) from $20.56   
Programming Python

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$29.99 price
(Save 42%)$51.99 List Price


If you've mastered Python's fundamentals, you're ready to start using it to get real work done. Programming Python will show you how, with in-depth tutorials on the language's primary application domains: system administration, GUIs, and the Web. You'll also explore how Python is used in databases, networking, front-end scripting layers, text processing, and more. This book focuses on commonly used tools and libraries to give you a comprehensive understanding of Python’s many roles in practical, real-world programming.

You'll learn language syntax and programming techniques in a clear and concise manner, with lots of examples that illustrate both correct usage and common idioms. Completely updated for version 3.x, Programming Python also delves into the language as a software development tool, with many code examples scaled specifically for that purpose.

Topics include:

  • Quick Python tour: Build a simple demo that includes data representation, object-oriented programming, object persistence, GUIs, and website basics
  • System programming: Explore system interface tools and techniques for command-line scripting, processing files and folders, running programs in parallel, and more
  • GUI programming: Learn to use Python’s tkinter widget library
  • Internet programming: Access client-side network protocols and email tools, use CGI scripts, and learn website implementation techniques
  • More ways to apply Python: Implement data structures, parse text-based information, interface with databases, and extend and embed Python
Read More Show Less

Product Details

  • ISBN-13: 9780596158101
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 1/5/2011
  • Edition description: Fourth Edition
  • Edition number: 4
  • Pages: 1584
  • Sales rank: 164,608
  • Product dimensions: 6.90 (w) x 9.20 (h) x 2.40 (d)

Meet the Author

Mark Lutz is the world leader in Python training, the author of Python's earliest and best-selling texts, and a pioneering figure in the Python community since 1992. He has been a software developer for 25 years, and is the author of O'Reilly's Programming Python, 3rd Edition and Python Pocket Reference, 3rd Edition.

Read More Show Less

Table of Contents

“And Now for Something Completely Different…”;
About This Book;
About This Fourth Edition;
What’s Left, Then?;
Python 3.X Impacts on This Book;
Using Book Examples;
Contacting O’Reilly;
Conventions Used in This Book;
The Beginning;
Chapter 1: A Sneak Preview;
1.1 “Programming Python: The Short Story”;
1.2 The Task;
1.3 Step 1: Representing Records;
1.4 Step 2: Storing Records Persistently;
1.5 Step 3: Stepping Up to OOP;
1.6 Step 4: Adding Console Interaction;
1.7 Step 5: Adding a GUI;
1.8 Step 6: Adding a Web Interface;
1.9 The End of the Demo;
System Programming;
Chapter 2: System Tools;
2.1 “The os.path to Knowledge”;
2.2 System Scripting Overview;
2.3 Introducing the sys Module;
2.4 Introducing the os Module;
Chapter 3: Script Execution Context;
3.1 “I’d Like to Have an Argument, Please”;
3.2 Current Working Directory;
3.3 Command-Line Arguments;
3.4 Shell Environment Variables;
3.5 Standard Streams;
Chapter 4: File and Directory Tools;
4.1 “Erase Your Hard Drive in Five Easy Steps!”;
4.2 File Tools;
4.3 Directory Tools;
Chapter 5: Parallel System Tools;
5.1 “Telling the Monkeys What to Do”;
5.2 Forking Processes;
5.3 Threads;
5.4 Program Exits;
5.5 Interprocess Communication;
5.6 The multiprocessing Module;
5.7 Other Ways to Start Programs;
5.8 A Portable Program-Launch Framework;
5.9 Other System Tools Coverage;
Chapter 6: Complete System Programs;
6.1 “The Greps of Wrath”;
6.2 A Quick Game of “Find the Biggest Python File”;
6.3 Splitting and Joining Files;
6.4 Generating Redirection Web Pages;
6.5 A Regression Test Script;
6.6 Copying Directory Trees;
6.7 Comparing Directory Trees;
6.8 Searching Directory Trees;
6.9 Visitor: Walking Directories “++”;
6.10 Playing Media Files;
6.11 Automated Program Launchers (External);
GUI Programming;
Chapter 7: Graphical User Interfaces;
7.1 “Here’s Looking at You, Kid”;
7.2 Python GUI Development Options;
7.3 tkinter Overview;
7.4 Climbing the GUI Learning Curve;
7.5 tkinter Coding Alternatives;
7.6 Adding Buttons and Callbacks;
7.7 Adding User-Defined Callback Handlers;
7.8 Adding Multiple Widgets;
7.9 Customizing Widgets with Classes;
7.10 Reusable GUI Components with Classes;
7.11 The End of the Tutorial;
7.12 Python/tkinter for Tcl/Tk Converts;
Chapter 8: A tkinter Tour, Part 1;
8.1 “Widgets and Gadgets and GUIs, Oh My!”;
8.2 Configuring Widget Appearance;
8.3 Top-Level Windows;
8.4 Dialogs;
8.5 Binding Events;
8.6 Message and Entry;
8.7 Checkbutton, Radiobutton, and Scale;
8.8 Running GUI Code Three Ways;
8.9 Images;
8.10 Viewing and Processing Images with PIL;
Chapter 9: A tkinter Tour, Part 2;
9.1 “On Today’s Menu: Spam, Spam, and Spam”;
9.2 Menus;
9.3 Listboxes and Scrollbars;
9.4 Text;
9.5 Canvas;
9.6 Grids;
9.7 Time Tools, Threads, and Animation;
9.8 The End of the Tour;
Chapter 10: GUI Coding Techniques;
10.1 “Building a Better Mousetrap”;
10.2 GuiMixin: Common Tool Mixin Classes;
10.3 GuiMaker: Automating Menus and Toolbars;
10.4 ShellGui: GUIs for Command-Line Tools;
10.5 GuiStreams: Redirecting Streams to Widgets;
10.6 Reloading Callback Handlers Dynamically;
10.7 Wrapping Up Top-Level Window Interfaces;
10.8 GUIs, Threads, and Queues;
10.9 More Ways to Add GUIs to Non-GUI Code;
10.10 The PyDemos and PyGadgets Launchers;
Chapter 11: Complete GUI Programs;
11.1 “Python, Open Source, and Camaros”;
11.2 PyEdit: A Text Editor Program/Object;
11.3 PyPhoto: An Image Viewer and Resizer;
11.4 PyView: An Image and Notes Slideshow;
11.5 PyDraw: Painting and Moving Graphics;
11.6 PyClock: An Analog/Digital Clock Widget;
11.7 PyToe: A Tic-Tac-Toe Game Widget;
11.8 Where to Go from Here;
Internet Programming;
Chapter 12: Network Scripting;
12.1 “Tune In, Log On, and Drop Out”;
12.2 Python Internet Development Options;
12.3 Plumbing the Internet;
12.4 Socket Programming;
12.5 Handling Multiple Clients;
12.6 Making Sockets Look Like Files and Streams;
12.7 A Simple Python File Server;
Chapter 13: Client-Side Scripting;
13.1 “Socket to Me!”;
13.2 FTP: Transferring Files over the Net;
13.3 Transferring Files with ftplib;
13.4 Transferring Directories with ftplib;
13.5 Transferring Directory Trees with ftplib;
13.6 Processing Internet Email;
13.7 POP: Fetching Email;
13.8 SMTP: Sending Email;
13.9 email: Parsing and Composing Mail Content;
13.10 A Console-Based Email Client;
13.11 The mailtools Utility Package;
13.12 NNTP: Accessing Newsgroups;
13.13 HTTP: Accessing Websites;
13.14 The urllib Package Revisited;
13.15 Other Client-Side Scripting Options;
Chapter 14: The PyMailGUI Client;
14.1 “Use the Source, Luke”;
14.2 Major PyMailGUI Changes;
14.3 A PyMailGUI Demo;
14.4 PyMailGUI Implementation;
14.5 Ideas for Improvement;
Chapter 15: Server-Side Scripting;
15.1 “Oh, What a Tangled Web We Weave”;
15.2 What’s a Server-Side CGI Script?;
15.3 Running Server-Side Examples;
15.4 Climbing the CGI Learning Curve;
15.5 Saving State Information in CGI Scripts;
15.6 The Hello World Selector;
15.7 Refactoring Code for Maintainability;
15.8 More on HTML and URL Escapes;
15.9 Transferring Files to Clients and Servers;
Chapter 16: The PyMailCGI Server;
16.1 “Things to Do When Visiting Chicago”;
16.2 The PyMailCGI Website;
16.3 The Root Page;
16.4 Sending Mail by SMTP;
16.5 Reading POP Email;
16.6 Processing Fetched Mail;
16.7 Utility Modules;
16.8 Web Scripting Trade-Offs;
Tools and Techniques;
Chapter 17: Databases and Persistence;
17.1 “Give Me an Order of Persistence, but Hold the Pickles”;
17.2 Persistence Options in Python;
17.3 DBM Files;
17.4 Pickled Objects;
17.5 Shelve Files;
17.6 The ZODB Object-Oriented Database;
17.7 SQL Database Interfaces;
17.8 ORMs: Object Relational Mappers;
17.9 PyForm: A Persistent Object Viewer (External);
Chapter 18: Data Structures;
18.1 “Roses Are Red, Violets Are Blue; Lists Are Mutable, and So Is Set Foo”;
18.2 Implementing Stacks;
18.3 Implementing Sets;
18.4 Subclassing Built-in Types;
18.5 Binary Search Trees;
18.6 Graph Searching;
18.7 Permuting Sequences;
18.8 Reversing and Sorting Sequences;
18.9 PyTree: A Generic Tree Object Viewer;
Chapter 19: Text and Language;
19.1 “See Jack Hack. Hack, Jack, Hack”;
19.2 Strategies for Processing Text in Python;
19.3 String Method Utilities;
19.4 Regular Expression Pattern Matching;
19.5 XML and HTML Parsing;
19.6 Advanced Language Tools;
19.7 Custom Language Parsers;
19.8 PyCalc: A Calculator Program/Object;
Chapter 20: Python/C Integration;
20.1 “I Am Lost at C”;
20.2 Extending Python in C: Overview;
20.3 A Simple C Extension Module;
20.4 The SWIG Integration Code Generator;
20.5 Wrapping C Environment Calls;
20.6 Wrapping C++ Classes with SWIG;
20.7 Other Extending Tools;
20.8 Embedding Python in C: Overview;
20.9 Basic Embedding Techniques;
20.10 Registering Callback Handler Objects;
20.11 Using Python Classes in C;
20.12 Other Integration Topics;
The End;
Chapter 21: Conclusion: Python and the Development Cycle;
21.1 “That’s the End of the Book, Now Here’s the Meaning of Life”;
21.2 “Something’s Wrong with the Way We Program Computers”;
21.3 The “Gilligan Factor”;
21.4 Doing the Right Thing;
21.5 Enter Python;
21.6 But What About That Bottleneck?;
21.7 On Sinking the Titanic;
21.8 “So What’s Python?”: The Sequel;
21.9 In the Final Analysis…;

Read More Show Less

Customer Reviews

Average Rating 3
( 5 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 5 Customer Reviews
  • Anonymous

    Posted March 4, 2013

    I think the world of this book; Mark Lutz has done a fantastic j

    I think the world of this book; Mark Lutz has done a fantastic job writing a comprehensive guide for many of Python's most useful features. I own the hard copy of the first release of the fourth edition, and it has been a fine resource for me, the last couple of years. It's an enormous book, though, and I wanted a more portable version. I opted for the Nook version rather than the PDF version from O'Reilly, and I believe this was the wrong choice.
    As a Nook product, Programming Python 4/e has a number of very frustrating flaws. First, the text of this ebook is that of the late 2010 release. The print version of the 4th edition has been updated a few times since the 2010 first printing, as indicated on the copyright pages of the respective printings, but the Nook edition I purchased in March 2013 does not include those updates. Caveat emptor.
    A second and far more value-diminishing flaw is that there is no Table of Contents within the text, for navigating straight to the topic you're interested in. This is an unbelievable omission: the book is 1,600 pages in hard copy, and 6,206 pages on my Nook device. That's a lot of ground to navigate without a map!
    (Nook's "Go To" function does work, but it only pulls up links to the six main parts of the book, plus the front matter and index--not the individual chapters, let alone the detailed sub-headings listed in the printed book's wonderfully complete 17-page Table of Contents. True, following the "Go To" link to Part III will pull up a list of the chapters in that part; but again, there is no way to navigate directly to the section you are interested in.)
    The typical chapter is about a hundred printed pages long, which amounts to several hundred pages on the Nook. Inevitably, unless the topic you are looking for happens to be on page one of a chapter, you'll end up spending a great deal of time skimming page after page after page, hoping to find what you are looking for, eventually. This introduces a fantastic waste of time into a busy programmer's workflow, and undermines one of the main reasons for using an ebook rather than a printed book: swiftness and convenience of access.
    Third, and most depressingly, the text formatting on the Nook completely messes up the whitespace in the code samples. If you're a Python programmer, that fact alone is reason enough to pass on this Nook edition.
    I would love to give five stars to Lutz's excellent book. But the parties responsible for converting his fine text have rendered it a virtually unusable, one-star Nook product.

    7 out of 7 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted November 23, 2013


    leaders den for snakeclan.

    0 out of 3 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted May 14, 2012

    No text was provided for this review.

  • Anonymous

    Posted July 13, 2011

    No text was provided for this review.

  • Anonymous

    Posted July 7, 2014

    No text was provided for this review.

Sort by: Showing all of 5 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)