Introduction1
Chapter 1: Rapid Introduction to Procedural Programming7
Creating and Running Python Programs 7
Python’s “Beautiful Heart” 12
Examples 36
Summary 42
Exercises 44
Chapter 2:Data Types47
Identifiers and Keywords 47
Integral Types 50
Floating-Point Types 54
Strings 61
Examples 88
Summary 95
Exercises 97
Chapter 3: Collection Data Types99
Sequence Types 99
Set Types 112
Mapping Types 117
Iterating and Copying Collections 127
Examples 138
Summary 146
Exercises 147
Chapter 4: Control Structures and Functions149
Control Structures 149
Exception Handling 153
Custom Functions 161
Example: make_html_skeleton.py 175
Summary 181
Exercise 182
Chapter 5: Modules185
Modules and Packages 185
Overview of Python’s Standard Library 202
Summary 219
Exercise 220
Chapter 6: Object-Oriented Programming223
The Object-Oriented Approach 224
Custom Classes 228
Custom Collection Classes 251
Summary 272
Exercises 274
Chapter 7: File Handling277
Writing and Reading Binary Data 282
Writing and Parsing Text Files 294
Writing and Parsing XML Files 302
Random Access Binary Files 313
Summary 326
Exercises 327
Chapter 8: Advanced Programming Techniques329
Further Procedural Programming 330
Further Object-Oriented Programming 353
Functional-Style Programming 384
Example: Valid.py 388
Summary 390
Exercises 392
Chapter 9: Processes and Threading395
Delegating Work to Processes 396
Delegating Work to Threads 400
Summary 409
Exercises 410
Chapter 10: Networking413
Creating a TCP Client 414
Creating a TCP Server 420
Summary 427
Exercises 427
Chapter 11: Database Programming431
DBM Databases 432
SQL Databases 436
Summary 443
Exercise 444
Chapter 12: Regular Expressions445
Python’s Regular Expression Language 446
The Regular Expression Module 455
Summary 464
Exercises 465
Chapter 13: Introduction to GUI Programming467
Dialog-Style Programs 470
Main-Window-Style Programs 476
Summary 491
Exercises 491
Epilogue493
Index495
Mark Summerfield is a computer science graduate with many years experience working in the software industry, primarily as a programmer. He also spent almost three years as Trolltech's documentation manager, during which he founded and edited Trolltech's technical journal, Qt Quarterly. (Trolltech is now Nokia's Qt Software.) Mark is the co-author of C++ GUI Programming with Qt 4 (Prentice Hall, 2006) and author of Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming (Prentice Hall, 2008). Mark owns Qtrac Ltd.,
![]() |
Ask a Question About this Product More... |
![]() |