Python Tour of Standard Library
*** MAY NEED REVISION ***
Based on the Tutorial, sections 10-11.
- 10.1 Operating system interface:
- os module, and the higher-level shutil [shell util] module.
- 10.2 File wildcards: glob module
- 10.3 Command line arguments:
- sys.argv; getopt and optparse modules
provide tools for parsing the arguments.
- 10.4 Error output and program termination:
- sys.stdin, sys.stdout, sys.stderr; sys.exit()
- 10.5 String pattern matching:
re module: regular expressions
- 10.6 Mathematics:
- modules math, random
- 10.7 Internet access:
- many modules; smtplib is one.
- 10.8 Dates and times:
- datetime module
- 10.9 Data compressions:
- modules zlib, gzip, bz2, zipfile, tarfile.
- 10.10 Performance measurement:
- timeit.Timer
- 10.11 Quality control
- doctest facilitates testing based on sample usage
in docstrings.
- unittest is more comprehensive, but requires more effort;
keeps the tests in a separate file.
- 10.12 Batteries included
- Packages include various XML RPC, email, and XML packages
- What is XML?
- 11.1 Output formatting
- repr, pprint (pretty print), textwrap (fit screen width),
locale (country-specific data formats, e.g., how to show
numbers
- 11.2 Templating
- string.Template class provides a convenient way for
specifying patterns with variables to be substituted.
- 11.3 Binary data record layouts
- Module struct functions pack() and unpack()
- 11.4 Multithreading: module threading
- 11.5 Logging: logging module, for writing to log files.
- 11.6 Weak references:
- tools for tracking objects without creating a reference
that prevents the objects from being garbage collected.
- 11.7 Working with lists:
- array module provides list-like arrays, however the arrays are
of homogeneous type and more compact than lists.
- Ordinary Python lists, however, are array-based,
not linked.
- The
collections module: deque, heapq
- (wait until taking C243, then you'll understand what
these are for.)
- 11.8 Exact decimal arithmetic:
- (Not really floating point.) Use for money.
No rounding errors.
- 12 What Now?
- Says we should browse through the Python Library Reference.
No Suggested Exercises
There are no exercises. The point of this part of the review
is to develop a nodding acquaintance with the Python standard
library, so that we can find libary modules when we need them.
E.g., I want to do some work with dates, or random numbers;
what are the Python library modules that might help me?
Then, read the documentation for those modules when we
need to. Not before.