Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


This book offers Python programmers one place to look when they need help remembering or deciphering the syntax of this open source language and its many powerful but scantily documented modules. This comprehensive reference guide makes it easy to look up the most frequently needed information--not just about the Python language itself, but also the most frequently used parts of the standard library and the most important third-party extensions.

Ask any Python aficionado and you'll hear that Python programmers have it all: an elegant object-oriented language with readable and maintainable syntax, that allows for easy integration with components in C, C++, Java, or C#, and an enormous collection of precoded standard library and third-party extension modules. Moreover, Python is easy to learn, yet powerful enough to take on the most ambitious programming challenges. But what Python programmers used to lack is a concise and clear reference resource, with the appropriate measure of guidance in how best to use Python's great power. Python in a Nutshell fills this need.

Python in a Nutshell, Second Edition covers more than the language itself; it also deals with the most frequently used parts of the standard library, and the most popular and important third party extensions. Revised and expanded for Python 2.5, this book now contains the gory details of Python's new subprocess module and breaking news about Microsoft's new IronPython project. Our "Nutshell" format fits Python perfectly by presenting the highlights of the most important modules and functions in its standard library, which cover over 90% of your practical programming needs. This book includes:

  • A fast-paced tutorial on the syntax of the Python language

  • An explanation of object-oriented programming in Python

  • Coverage of iterators, generators, exceptions, modules, packages, strings, and regular expressions

  • A quick reference for Python's built-in types and functions and key modules

  • Reference material on important third-party extensions, such as Numeric and Tkinter

  • Information about extending and embedding Python

Python in a Nutshell provides a solid, no-nonsense quick reference to information that programmers rely on the most. This book will immediately earn its place in any Python programmer's library.

"In a nutshell, Python in a Nutshell serves one primary goal: to act as an immediately accessible goal for the Python language. True, you can get most of the same core information that is presented within the covers of this volume online, but this will invariably be broken into multiple files, and in all likelihood lacking the examples or the exact syntax description necessary to truly understand a command." --Richard Cobbett, Linux Format

"O'Reilly has several good books, of which Python in a Nutshell by Alex Martelli is probably the best for giving you some idea of what Python is about and how to do useful things with it." --Jerry Pournelle, Byte Magazine

Praise for the First Edition:

Subscriber Reviews

Average Rating: 3 out of 5 rating Based on 1 Rating

"Not suited to learning the language quickly" - by Mark Horgan on 04-SEP-2013
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I wanted to learn Python quickly for a project. Programming Python was too advanced and Learning Python was too long (though it's a good book for learning the language from scratch). So I thought this would get me up to speed quickly as I already know other programming languages. I found it goes into a lot of detail that I didn't need to know so instead I used the official Python Tutorial. Maybe 'in a Nutshell' books are more suited to people who already know the topic but want to learn all the nitty gritty details in a compact form.
Report as Inappropriate

Table of Contents



The publisher has provided additional content related to this title.


Visit the catalog page for Python in a Nutshell, 2nd Edition

  • Catalog Page

Visit the errata page for Python in a Nutshell, 2nd Edition

  • Errata