The Python Standard Library provides a built-in module that contains classes to read, process, and write CSV files. Although this module is quite helpful for simple manipulations, it is recommended to use Pandas for more complex numerical analysis.
The Python Standard Library is a collection of script modules accessible to a Python program to simplify the programming process and removing the need to rewrite commonly used commands. They can be used by 'calling/importing' them at the beginning of a script.
Modules to cover in a 1-2 hour slot entirely depend on your audience's interest or focus. What other classes are they taking? What are they prepared to make use of immediately?
Be sure to mention math
, decimal
and datetime
and time
and re
.
For IT-types who will be doing file-oriented work: glob
, fnmatch
, os
, os.path
, tempfile
, and shutil
.
Database folks must hear about sqlite
and json
.
Simulation audience may want to hear about random
.
Web developers must hear about urllib2
from a client point of view. Also Beautiful Soup and an XML parser of your choice.
Web developers must hear about logging
and wsgiref
from a server point of view.
I'd offer itertools
and functools
. These modules operate over abstractions that are found everywhere in programming, so I think they are useful to study. Among more practical things, xml modules (xml.dom
, xml.sax
) can be very useful.
Have a look at PyMOTW (Python Module Of The Week). Although it is not strictly stdlib, it's a great resource of obvious and not so obvious gems of the python stdlib. What's more, it also serves as excellent documentation of the introduced modules.
I'd go for a few modules which make the most sense to a typical computer user/programmer performing typical computer tasks. That way, there's the largest chance that they might actually use python on their own time.
In my opinion, the operations most people will likely perform are file operations, for example going over every file in a directory and performing some action on it.
Therefore, I'd say the modules: os and os.path are probably the most important, and also mention glob, fnmatch and shutil. Also, subprocess might be very useful too, since it tends to get used in the above mentioned context.
Lastly, I'd go with optparse, since that will get them into very quickly making usable, programmer-friendly programs, which hopefully will also encourage them to actually write programs that other people want to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With