Python In A Nutshell 2nd Edition V413HAV.pdf

(21915 KB) Pobierz
920114802.009.png
920114802.010.png
PYTHON
IN A NUTSHELL
Second Edition
Alex Martelli
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
920114802.011.png 920114802.012.png 920114802.001.png 920114802.002.png 920114802.003.png 920114802.004.png 920114802.005.png 920114802.006.png
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
Cover Designer: Emma Colby
Interior Designer: Brett Kerr
Cover Illustrator: Karen Montgomery
Illustrators: Robert Romano and Jessamyn
Read
Printing History:
March 2003:
First Edition.
July 2006:
Second Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered
trademarksof 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]
920114802.007.png
Chapter 1
Table of Contents
Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Part I.
Getting Started with Python
1.
Introduction to Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
The Python Language
3
The Python Standard Library and Extension Modules
5
Python Implementations
5
Python Development and Versions
8
Python Resources
9
2.
Installation
14
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Installing Python from Source Code
14
Installing Python from Binaries
18
Installing Jython
20
Installing IronPython
21
3.
The Python Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
The python Program
22
Python Development Environments
26
Running Python Programs
28
The jython Interpreter
29
The IronPython Interpreter
30
iii
920114802.008.png
 
Zgłoś jeśli naruszono regulamin