Python in a Nutshell - Alex Martelli.pdf

(12929 KB) Pobierz
PYTHON
IN A NUTSHELL
Second Edition
Alex Martelli
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
Python in a Nutshell, Second Edition
by Alex Martelli
Copyright © 2006, 2003 O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online
editions are also available for most titles (safari.oreilly.com). For more information, contact
our corporate/institutional sales department: (800) 998-9938 or
corporate@oreilly.com.
Editor:
Mary T. O’Brien
Production Editor:
Matt Hutchinson
Copyeditor:
Linley Dolby
Proofreader:
Matt Hutchinson
Indexer:
Johnna Dinse
Printing History:
March 2003:
July 2006:
First Edition.
Second Edition.
Cover Designer:
Emma Colby
Interior Designer:
Brett Kerr
Cover Illustrator:
Karen Montgomery
Illustrators:
Robert Romano and Jessamyn
Read
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered
trademarks of O’Reilly Media, Inc. The
In a Nutshell
series designations,
Python in a Nutshell,
the image of an African rock python, and related trade dress are trademarks of O’Reilly
Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in this book, and O’Reilly Media,
Inc. was aware of a trademark claim, the designations have been printed in caps or initial
caps.
While every precaution has been taken in the preparation of this book, the publisher and
author assume no responsibility for errors or omissions, or for damages resulting from the use
of the information contained herein.
ISBN: 978-0596-10046-9
[LSI]
[2011-07-01]
Chapter 1
Table of Contents
Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ix
Part I. Getting Started with Python
1. Introduction to Python
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
The Python Language
The Python Standard Library and Extension Modules
Python Implementations
Python Development and Versions
Python Resources
3
5
5
8
9
2. Installation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
Installing Python from Source Code
Installing Python from Binaries
Installing Jython
Installing IronPython
14
18
20
21
3. The Python Interpreter
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
The python Program
Python Development Environments
Running Python Programs
The jython Interpreter
The IronPython Interpreter
22
26
28
29
30
iii
Zgłoś jeśli naruszono regulamin