Python Phrasebook

( 2 )


Python Phrasebook

Brad Dayley

Essential Code and Commands

Python Phrasebook gives you the code phrases you need to quickly and effectively complete your programming projects in Python.

Concise and Accessible

Easy to carry and easy to ...

See more details below
$17.13 price
(Save 42%)$29.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (15) from $1.99   
  • New (6) from $15.81   
  • Used (9) from $1.99   
Sending request ...


Python Phrasebook

Brad Dayley

Essential Code and Commands

Python Phrasebook gives you the code phrases you need to quickly and effectively complete your programming projects in Python.

Concise and Accessible

Easy to carry and easy to use–lets you ditch all those bulky books for one portable guide

Flexible and Functional

Packed with more than 100 customizable code snippets–so you can readily code functional Python in just about any situation

Brad Dayley is a software engineer at Novell, Inc. He has been a system administrator and software developer on the Unix, Windows, Linux, and NetWare platforms for the past 14 years. Brad co-developed an advanced debugging course used to train engineers and customers and is the co-author of several Novell Press books.

Programming / Python

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Every language contains a bunch of phrases that its speakers use constantly. Understand those phrases, and you won't just get by: You've gone a long way toward real mastery. That's as true for Python as it is for French. And, in this pocket-size Python Phrasebook, Brad Dayley's brought together those phrases for the first time.

If you need a quick way to compare (or join, split, search, or execute code inside) strings, turn here. Same if you need to define or access a list, construct or manipulate a dictionary, read or write a file, start or synchronize a thread. Or manage a MySQL database, create HTTP requests, retrieve POP3 email, parse URLs or XML tags, retrieve links from HTML documents, or create XML-RPC servers.

Maybe you've noticed what we've noticed: Dayley has captured the tasks real developers actually perform. Which makes his book superbly useful. Bill Camarda, from the January 2007 Read Only

Read More Show Less

Product Details

  • ISBN-13: 9780672329104
  • Publisher: Sams
  • Publication date: 11/20/2006
  • Series: Developer's Library
  • Pages: 288
  • Sales rank: 658,670
  • Product dimensions: 4.50 (w) x 7.00 (h) x 0.61 (d)

Meet the Author

Brad Dayley is a senior software engineer in Novell’s Nterprise Development Group. He has 14 years of experience installing, troubleshooting, and developing Novell’s products for NetWare and Linux. He is the co-author of Novell’s Guide to Resolving Critical Server Issues, as well as seven other Novell Press titles on the ZENworks suite.

When he is not writing books or software, he can be found biking, hiking, and/or Jeeping somewhere in the remote regions of the Pacific Northwest with his wife, DaNae, and four sons.

Read More Show Less

Table of Contents

Chapter 1 Understanding Python 3

Why Use Python?

Invoking the Interpreter

Built-In Types

Understanding Python Syntax

Python Objects, Modules, Classes, and Functions

Error Handling

Using System Tools

Chapter 2 Manipulating Strings

Comparing Strings

Joining Strings

Splitting Strings

Searching Strings for Substrings

Search and Replace in Strings

Searching Strings for Specific Endings/Beginnings

Trimming Strings

Aligning/Formatting Strings

Executing Code Inside Strings

Interpolating Variables Inside Strings

Converting Unicode to Local Strings

Chapter 3 Managing Data Types

Defining a List

Accessing a List

Slicing a List

Adding and Removing Items in a List

Sorting a List

Using Tuples

Constructing a Dictionary

Adding a Value to a Dictionary

Retrieving a Value from a Dictionary

Slicing a Dictionary

Swapping Keys for Values in a Dictionary

Chapter 4 Managing Files

Opening and Closing Files

Reading an Entire File

Reading a Single Line from a File

Accessing Each Word in a File

Writing a File

Determining the Number of Lines in a File

Walking the Directory Tree

Renaming Files

Recursively Deleting Files and Subdirectories

Searching for Files Based on Extension

Creating a TAR File

Extracting a File from a TAR File

Adding Files to a ZIP File

Retrieving Files from a ZIP File

Chapter 5 Managing Threads

Starting a New Thread

Creating and Exiting Threads

Synchronizing Threads

Implementing a Multithreaded Priority Queue

Initiating a Timer-Interrupted Thread

Chapter 6 Managing Databases

Adding Entries to a DBM File

Retrieving Entries from a DBM File

Updating Entries in a DBM File

Pickling Objects to a File

Unpickling Objects from a File

Storing Objects in a Shelve File

Retrieving Objects from a Shelve File

Changing Objects in a Shelve File

Connecting to a MySQL Database Server

Creating a MySQL Database

Adding Entries to a MySQL Database

Retrieving Entries from a MySQL Database

Chapter 7 Implementing Internet Communication

Opening a Server-Side Socket for Receiving Data

Opening a Client-Side Socket for Sending Data

Receiving Streaming Data Using the ServerSocket Module

Sending Streaming Data

Sending Email Using SMTP

Retrieving Email from a POP3 Server

Using Python to Fetch Files from an FTP Server

Chapter 8 Processing HTML

Parsing URLs

Opening HTML Documents

Retrieving Links from HTML Documents

Retrieving Images from HTML Documents

Retrieving Text from HTML Documents

Retrieving Cookies in HTML Documents

Adding Quotes to Attribute Values in HTML Documents

Chapter 9 Processing XML

Loading an XML Document

Checking for Well-Formed XML Documents

Accessing Child Nodes

Accessing Element Attributes

Adding a Node to a DOM Tree

Removing a Node from a DOM Tree

Searching XML Documents

Extracting Text from XML Documents

Parsing XML Tags

Chapter 10 Programming Web Services

Adding HTML to Web Pages Using CGI Scripts

Processing Parameters Passed to CGI Scripts

Creating Self-Posting CGI Scripts

Allowing Users to Upload Files via CGI Scripts

Creating an HTTP Server to Handle GET Requests

Creating an HTTP Server to Handle POST Requests

Creating an HTTP Server to Process CGI Scripts

Sending an HTTP GET Request from a Python Script

Sending an HTTP POST Request from a Python Script

Creating an XML-RPC Server

Creating an XML-RPC Client

Using SOAPpy to Access SOAP Web Services Through a WSDL File

TOC 0672329107 10/11/2006

Read More Show Less

Customer Reviews

Average Rating 4.5
( 2 )
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 2 Customer Reviews
  • Posted April 6, 2009

    more from this reviewer


    Having experience in a few other languages, I decided to buy this book to supplement the documentation on It is filled with examples and explanations. I was surprised at how concise the book is. It's nice to pick up a book that assumes you have a general understanding of the language and gets right down to the material. This is an excellent book if you want to have a handy reference.

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

    Posted November 17, 2006

    code snippets to get the job done

    Dayley offers you a useful Python aid. Deliberately written to be concise, and assuming that the reader already knows some Python. You cannot or should not use this book to learn the language. But once having some acquaintance with Python, the book can help. It's not a dictionary of Python commands. Rather, Dayley thought of likely tasks you'll often need to do. He then supplies explanations and code snippets. The tasks include getting a given file from a tar file, or making a dictionary (hash table), or making a MySQL database. The snippets are typically less than 100 lines, and get the job done.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

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