- ホーム
- > 洋書
- > 英文書
- > Computer / Languages
Full Description
"Hellmann's writing has become an indispensable resource for me and many others as it fills a critical gap in Python Documentation with examples."- Jesse Noller, Python Core Developer and PSF Board MemberMaster the Powerful Python Standard Library through Real Code ExamplesThe Python Standard Library contains hundreds of modules for interacting with the operating system, interpreter, and Internet-all extensively tested and ready to jump-start your application development. The Python Standard Library by Example (2 Volume Set) introduces virtually every important area of the Python 2.7 library through concise, stand-alone source code/output examples, designed for easy learning and reuse.Building on his popular Python Module of the Week blog series, author and Python expert Doug Hellmann focuses on "showing" not "telling." He explains code behavior through downloadable examples that fully demonstrate each feature.You'll find practical code for working with text, data types, algorithms, math, file systems, networking, the Internet, XML, email, cryptography, concurrency, runtime and language services, and much more. Each section fully covers one module, and links to valuable additional resources, making this book an ideal tutorial and reference. Coverage includesManipulating text with string, textwrap, re, and difflib Implementing data structures: collections, array, queue, struct, copy, and more Reading, writing, and manipulating files and directories Regular expression pattern matching Exchanging data and providing for persistence Archiving and data compression Managing processes and threads Using application "building blocks": parsing command-line options, prompting for passwords, scheduling events, and logging Testing, debugging, and compilation Controlling runtime configuration Using module and package utilitiesIf you're new to Python, this book will quickly give you access to a whole new world of functionality. If you've worked with Python before, you'll discover new, powerful solutions and better ways to use the modules you've already tried.
Contents
Tables xxxiForeword xxxiiiAcknowledgments xxxviiAbout the Author xxxixIntroduction 1Chapter 1: Text 31.1 string-Text Constants and Templates 41.2 textwrap-Formatting Text Paragraphs 91.3 re-Regular Expressions 131.4 difflib-Compare Sequences 61Chapter 2: Data Structures 692.1 collections-Container Data Types 702.2 array-Sequence of Fixed-Type Data 842.3 heapq-Heap Sort Algorithm 872.4 bisect-Maintain Lists in Sorted Order 932.5 Queue-Thread-Safe FIFO Implementation 962.6 struct-Binary Data Structures 1022.7 weakref-Impermanent References to Objects 1062.8 copy-Duplicate Objects 1172.9 pprint-Pretty-Print Data Structures 123Chapter 3: Algorithms 1293.1 functools-Tools for Manipulating Functions 1293.2 itertools-Iterator Functions 1413.3 operator-Functional Interface to Built-in Operators 1533.4 contextlib-Context Manager Utilities 163Chapter 4: Dates and Times 1734.1 time-Clock Time 1734.2 datetime-Date and Time Value Manipulation 1804.3 calendar-Work with Dates 191Chapter 5: Mathematics 1975.1 decimal-Fixed and Floating-Point Math 1975.2 fractions-Rational Numbers 2075.3 random-Pseudorandom Number Generators 2115.4 math-Mathematical Functions 223Chapter 6: The File System 2476.1 os.path-Platform-Independent Manipulation of Filenames 2486.2 glob-Filename Pattern Matching 2576.3 linecache-Read Text Files Efficiently 2616.4 tempfile-Temporary File System Objects 2656.5 shutil-High-Level File Operations 2716.6 mmap-Memory-Map Files 2796.7 codecs-String Encoding and Decoding 2846.8 StringIO-Text Buffers with a File-like API 3146.9 fnmatch-UNIX-Style Glob Pattern Matching 3156.10 dircache-Cache Directory Listings 3196.11 filecmp-Compare Files 322Chapter 7: Data Persistence and Exchange 3337.1 pickle-Object Serialization 3347.2 shelve-Persistent Storage of Objects 3437.3 anydbm-DBM-Style Databases 3477.4 whichdb-Identify DBM-Style Database Formats 3507.5 sqlite3-Embedded Relational Database 3517.6 xml.etree.ElementTree-XML Manipulation API 3877.7 csv-Comma-Separated Value Files 411Chapter 8: Data Compression and Archiving 4218.1 zlib-GNU zlib Compression 4218.2 gzip-Read and Write GNU Zip Files 4308.3 bz2-bzip2 Compression 4368.4 tarfile-Tar Archive Access 4488.5 zipfile-ZIP Archive Access 457Chapter 9: Cryptography 4699.1 hashlib-Cryptographic Hashing 4699.2 hmac-Cryptographic Message Signing and Verification 473Chapter 10: Processes and Threads 48110.1 subprocess-Spawning Additional Processes 48110.2 signal-Asynchronous System Events 49710.3 threading-Manage Concurrent Operations 50510.4 multiprocessing-Manage Processes like Threads 529Chapter 11: Networking 56111.1 socket-Network Communication 56111.2 select-Wait for I/O Efficiently 59411.3 SocketServer-Creating Network Servers 60911.4 asyncore-Asynchronous I/O 61911.5 asynchat-Asynchronous Protocol Handler 629Chapter 12: The Internet 63712.1 urlparse-Split URLs into Components 63812.2 BaseHTTPServer-Base Classes for Implementing Web Servers 64412.3 urllib-Network Resource Access 65112.4 urllib2-Network Resource Access 65712.5 base64-Encode Binary Data with ASCII 67012.6 robotparser-Internet Spider Access Control 67412.7 Cookie-HTTP Cookies 67712.8 uuid-Universally Unique Identifiers 68412.9 json-JavaScript Object Notation 69012.10 xmlrpclib-Client Library for XML-RPC 70212.11 SimpleXMLRPCServer-An XML-RPC Server 714Chapter 13: Email 72713.1 smtplib-Simple Mail Transfer Protocol Client 72713.2 smtpd-Sample Mail Servers 73413.3 imaplib-IMAP4 Client Library 73813.4 mailbox-Manipulate Email Archives 758Chapter 14: Application Building Blocks 76914.1 getopt-Command-Line Option Parsing 77014.2 optparse-Command-Line Option Parser 77714.3 argparse-Command-Line Option and Argument Parsing 79514.4 readline-The GNU Readline Library 82314.5 getpass-Secure Password Prompt 83614.6 cmd-Line-Oriented Command Processors 83914.7 shlex-Parse Shell-Style Syntaxes 85214.8 ConfigParser-Work with Configuration Files 86114.9 logging-Report Status, Error, and Informational Messages 87814.10 fileinput-Command-Line Filter Framework 88314.11 atexit-Program Shutdown Callbacks 89014.12 sched-Timed Event Scheduler 894Chapter 15: Internationalization and Localization 89915.1 gettext-Message Catalogs 89915.2 locale-Cultural Localization API 909Chapter 16: Developer Tools 91916.1 pydoc-Online Help for Modules 92016.2 doctest-Testing through Documentation 92116.3 unittest-Automated Testing Framework 94916.4 traceback-Exceptions and Stack Traces 95816.5 cgitb-Detailed Traceback Reports 96516.6 pdb-Interactive Debugger 97516.7 trace-Follow Program Flow 101216.8 profile and pstats-Performance Analysis 102216.9 timeit-Time the Execution of Small Bits of Python Code 103116.10 compileall-Byte-Compile Source Files 103716.11 pyclbr-Class Browser 1039Chapter 17: Runtime Features 104517.1 site-Site-Wide Configuration 104617.2 sys-System-Specific Configuration 105517.3 os-Portable Access to Operating System Specific Features 110817.4 platform-System Version Information 112917.5 resource-System Resource Management 113417.6 gc-Garbage Collector 113817.7 sysconfig-Interpreter Compile-Time Configuration 1160Chapter 18: Language Tools 116918.1 warnings-Nonfatal Alerts 117018.2 abc-Abstract Base Classes 117818.3 dis-Python Bytecode Disassembler 118618.4 inspect-Inspect Live Objects 120018.5 exceptions-Built-in Exception Classes 1216Chapter 19: Modules and Packages 123519.1 imp-Python's Import Mechanism 123519.2 zipimport-Load Python Code from ZIP Archives 124019.3 pkgutil-Package Utilities 1247Index of Python Modules 1259Index 1261