Simple python examples

What you want What it is called Examples
Command-line inputsys.argv
Function definitiondef
Reading in lines from standard inputsys.stdin
Substitution using regular expressionsre
length of a
Convert string to
find something in
Sort a
Split a
Reading lines from a fileopen,
Random numbersrandom.random()
Automatic execution__name__,
Plotting graphsGnuplot
Plotting histogramspylab.hist
Automated testingdoctest

David MacKay / python resources /

David MacKay / Computational Physics wiki (UCAM only) / C++ resources /