The Python distribution comes with lots of scripts that you can study and use. Those scripts are stored in two directories: \Tools and \Demos.
Table 17.2. Programs Stored in the Tools\ Scripts Directory
Program
|
Description
|
byteyears |
Prints the product of a file's size and age |
checkpyc |
Checks presence and validity of .pyc files |
classfix |
Converts old class syntax to new |
copytime |
Copies one file's atime and mtime to another |
crlf |
Changes CRLF line endings to LF (Windows to UNIX) |
cvsfiles |
Prints a list of files that are under CVS |
dutree |
Formats du output as a tree sorted by size |
eptags |
Creates Emacs TAGS file for Python modules |
findlinksto
|
Recursively finds symbolic links to a given path prefix
|
fixcid
|
Massive identifier substitution on C source files |
fixheader
|
Adds some cpp magic to a C include file |
fixnotice
|
Fixes the copyright notice in source files |
fixps
|
Fixes Python scripts'first line (if #!)
|
ftpmirror
|
FTP mirror script |
h2py
|
Translates #defines into Python assignments
|
ifdef
|
Removes #if(n)def groups from C sources
|
lfcr
|
Changes LF line endings to CRLF (UNIX to Windows) |
linktree
|
Makes a copy of a tree with links to original files |
lll
|
Finds and lists symbolic links in current directory |
logmerge
|
Consolidates CVS/RCS logs read from stdin |
mailerdaemon
|
Parses error messages from mailer daemons |
methfix
|
Fixes old method syntax def f(self, (a1, ..., aN)):
|
mkreal
|
Turns a symbolic link into a real file or directory |
ndiff
|
Intelligent diff between text files |
nm2def
|
Creates a template for PC/python_nt.def |
objgraph
|
Prints object graph from nm output on a library
|
pathfix
|
Changes #!/usr/local/bin/python into something else
|
pdeps
|
Prints dependencies between Python modules |
pindent
|
Indents Python code, giving block-closing comments |
ptags
|
Creates vi tags file for Python modules |
rgrep
|
Reverses grep through a file |
suff
|
Sorts a list of files by suffix |
sum5
|
Prints md5 checksums of files |
tabnanny
|
Checks inconsistent mixing of tabs and spaces |
tabpolice
|
Checks for ambiguous indentation |
texi2html
|
Converts GNU texinfo files into HTML |
treesync
|
Synchronizes source trees |
untabify
|
Replaces tabs with spaces in argument files |
which
|
Finds a program in $PATH |
xxci
|
Wrapper for rcsdiff and ci |
Table 17.3. Programs Stored in the Demo Directory
Program
|
Description
|
classes |
Some examples of how to use classes. |
dns |
Module that implements a DNS client. |
embed |
Example of embedding Python in another application (see also pysvr). |
extend |
Example of using the generic Makefile.pre.in from the Misc directory to build a statically linked or shared extension module. |
ibrowse |
Emacs info file browser (uses stdwin). |
md5test |
Test program for the optional md5 module. |
metaclasses |
Metaclasses examples. |
pdist |
Filesystem, RCS, and CVS client and server classes. This directory contains various modules and classes that support remote file system operations. |
pysvr |
Example of embedding Python in a threaded application. |
rp |
Set of classes for building clients and servers for Sun RPC.
|
sockets |
Examples for the new built-in module socket.
|
sgi |
Demos that only run on Silicon Graphics machines. |
stdwin |
Demos that use the STDWIN library. |
threads |
Demos that use the thread module (for SGIs). |
tkinter |
Demos using the Tk interface. |
zlib |
zlib demo. |
Table 17.4. Programs Stored in the Demos/Scripts Directory
Script
|
Description
|
fact |
Factorizes numbers |
from |
Summarizes mailbox |
ftpstats |
Summarizes ftp daemon log file |
lpwatch |
Watches BSD line printer queues |
markov |
Markov chain simulation of words or characters |
mboxconvvert |
Converts MH or MMDF mailboxes to UNIX mailbox format |
morse |
Produces Morse code (audible or on AIFF file) |
mpzpi |
test mpz—prints digits of pi (compare pi.py) |
pi |
Prints all digits of pi—given enough time and memory |
pp |
Emulates some Perl command line options |
primes |
Prints prime numbers |
script |
Equivalent to BSD script |
unbirthday |
Prints unbirthday count |
update |
Updates a bunch of files according to a script
|