Python Cookbook

Front Cover
Alex Martelli, David Ascher
"O'Reilly Media, Inc.", 2002 - Computers - 574 pages

ThePython Cookbookis a collection of problems, solutions, and practical examples for Python programmers, written by Python programmers. Over the past year, members of the Python community have contributed material to an online repository of Python recipes hosted by ActiveState. This book contains the best of those recipes, accompanied by overviews and background material by key Python figures.

The recipes in thePython Cookbookrange from simple tasks, such as working with dictionaries and list comprehensions, to entire modules that demonstrate templating systems and network monitoring. This book contains over 200 recipes on the following topics:

  • Searching and sorting
  • Manipulating text
  • Working with files and the filesystem
  • Object-oriented programming
  • Dealing with threads and processes
  • System administration
  • Interacting with databases
  • Creating user interfaces
  • Network and web programming
  • Processing XML
  • Distributed programming
  • Debugging and testing
  • Extending Python

This book is a treasure trove of useful code for all Python programmers, from novices to advanced practitioners, with contributions from such Python luminaries as Guido Van Rossum, David Ascher, Tim Peters, Paul Prescod, Mark Hammond, and Alex Martelli, as well as over 100 other Python programmers. The recipes highlight Python best practices and can be used directly in day-to-day programming tasks, as a source of ideas, or as a way to learn more about Python.

The recipes in thePython Cookbookwere edited by David Ascher, who is on the board of the Python Software Foundation and is the co-author ofLearning Python,and Alex Martelli, who is known for his numerous and exhaustive postings on the Python mailing list. The book contains a foreword by Guido van Rossum, the creator of Python.

 

What people are saying - Write a review

User ratings

5 stars
5
4 stars
7
3 stars
0
2 stars
3
1 star
0

LibraryThing Review

User Review  - jcrben - LibraryThing

Even though it's intended for experienced developers, it helped me understand some of the tricky issues that I was running into just starting out. Read full review

LibraryThing Review

User Review  - tomhudson - LibraryThing

Probably just not the book I needed at the time, but disappointing for me - make sure that the "recipes" in here actually address problems somewhat related to the ones you're dealing with. Read full review

Contents

I
v
II
xiii
III
xvii
IV
1
VI
3
VII
4
VIII
6
IX
7
CXLII
260
CXLIII
262
CXLIV
264
CXLVI
267
CXLVII
269
CXLVIII
272
CXLIX
275
CL
276

X
8
XI
11
XII
13
XIII
15
XIV
18
XV
20
XVI
21
XVII
23
XVIII
25
XIX
27
XX
28
XXI
30
XXII
31
XXIII
34
XXV
38
XXVI
40
XXVII
42
XXVIII
43
XXIX
46
XXX
47
XXXI
49
XXXII
52
XXXIII
54
XXXIV
57
XXXV
59
XXXVI
61
XXXVII
63
XXXVIII
69
XXXIX
70
XL
71
XLII
72
XLIII
74
XLIV
76
XLV
78
XLVI
79
XLVII
81
XLVIII
83
XLIX
85
L
86
LI
88
LII
91
LIII
93
LIV
94
LV
96
LVI
97
LVII
99
LVIII
100
LIX
104
LX
109
LXI
113
LXII
117
LXIII
119
LXV
121
LXVI
122
LXVII
123
LXVIII
125
LXIX
127
LXX
129
LXXI
132
LXXII
134
LXXIII
135
LXXIV
137
LXXVI
138
LXXVII
140
LXXVIII
141
LXXIX
143
LXXX
144
LXXXI
145
LXXXII
146
LXXXIII
147
LXXXIV
148
LXXXV
150
LXXXVI
152
LXXXVII
154
LXXXVIII
156
LXXXIX
160
XCI
165
XCII
167
XCIII
169
XCV
172
XCVI
174
XCVII
176
XCVIII
177
XCIX
179
C
182
CI
183
CII
186
CIII
188
CIV
189
CV
191
CVI
193
CVII
194
CVIII
198
CIX
201
CX
202
CXI
203
CXII
206
CXIII
208
CXIV
211
CXV
214
CXVII
217
CXVIII
218
CXIX
220
CXX
222
CXXI
225
CXXII
227
CXXIII
229
CXXIV
231
CXXV
233
CXXVI
236
CXXVIII
237
CXXIX
238
CXXX
240
CXXXI
242
CXXXII
243
CXXXIII
245
CXXXIV
246
CXXXV
248
CXXXVI
250
CXXXVII
253
CXXXVIII
254
CXXXIX
255
CXL
257
CXLI
258
CLI
278
CLII
279
CLIII
281
CLIV
283
CLV
285
CLVI
288
CLVII
291
CLVIII
298
CLIX
300
CLX
301
CLXI
303
CLXII
304
CLXIII
307
CLXIV
308
CLXV
311
CLXVI
313
CLXVII
315
CLXVIII
317
CLXIX
318
CLXX
322
CLXXI
326
CLXXII
328
CLXXIII
330
CLXXIV
331
CLXXV
333
CLXXVI
334
CLXXVII
336
CLXXVIII
337
CLXXIX
338
CLXXX
340
CLXXXI
342
CLXXXII
344
CLXXXIII
346
CLXXXIV
350
CLXXXV
353
CLXXXVI
356
CLXXXVII
357
CLXXXVIII
359
CLXXXIX
361
CXC
362
CXCI
364
CXCII
366
CXCIII
368
CXCIV
369
CXCV
372
CXCVI
374
CXCVII
377
CXCVIII
379
CXCIX
380
CC
382
CCI
383
CCII
384
CCIII
385
CCIV
387
CCV
389
CCVI
390
CCVII
393
CCVIII
395
CCIX
398
CCX
402
CCXI
404
CCXII
405
CCXIII
407
CCXIV
409
CCXV
412
CCXVI
414
CCXVII
417
CCXVIII
420
CCXIX
423
CCXXI
424
CCXXII
425
CCXXIII
428
CCXXIV
429
CCXXV
432
CCXXVI
434
CCXXVII
437
CCXXVIII
440
CCXXIX
444
CCXXX
449
CCXXXI
452
CCXXXII
454
CCXXXIII
455
CCXXXIV
457
CCXXXV
460
CCXXXVI
461
CCXXXVII
463
CCXXXVIII
465
CCXXXIX
467
CCXL
469
CCXLI
471
CCXLII
475
CCXLIII
477
CCXLIV
481
CCXLV
485
CCXLVI
488
CCXLVII
489
CCXLVIII
491
CCXLIX
494
CCL
496
CCLI
497
CCLII
499
CCLIII
503
CCLIV
506
CCLV
507
CCLVI
509
CCLVII
513
CCLVIII
515
CCLIX
517
CCLX
519
CCLXI
521
CCLXII
522
CCLXIII
524
CCLXIV
526
CCLXV
529
CCLXVI
530
CCLXVII
532
CCLXVIII
533
CCLXIX
535
CCLXX
536
CCLXXI
539
CCLXXII
547
CCLXXIII
551
Copyright

Common terms and phrases

About the author (2002)

Alex Martelli spent 8 years with IBM Research, winning three Outstanding Technical Achievement Awards. He then spent 13 as a Senior Software Consultant at think3 inc, developing libraries, network protocols, GUI engines, event frameworks, and web access frontends. He has also taught programming languages, development methods, and numerical computing at Ferrara University and other venues. He's a C++ MVP for Brainbench, and a member of the Python Software Foundation. He currently works for AB Strakt, a Python-centered software house in Gteborg, Sweden, mostly by telecommuting from his home in Bologna, Italy. Alex's proudest achievement is the articles that appeared in Bridge World (January/February 2000), which were hailed as giant steps towards solving issues that had haunted contract bridge theoreticians for decades.

David Ascher is the lead for Python projects at ActiveState, including Komodo, ActiveState's integrated development environment written mostly in Python. David has taught courses about Python to corporations, in universities, and at conferences. He also organized the Python track at the 1999 and 2000 O'Reilly Open Source Conventions, and was the program chair for the 10th International Python Conference. In addition, he co-wrote Learning Python (both editions) and serves as a director of the Python Software Foundation. David holds a B.S. in physics and a Ph.D. in cognitive science, both from Brown University.

Bibliographic information