- May 25, 2001
- Python Libraries
- Python Services
- The String Group
- Generic Operational System
- Optional Operational System
- Internet Protocol and Support
- Internet Data Handling
- Restricted Execution
- UNIX Specific
- SGI IRIX Specific
- Sun OS Specific
- MS Windows Specific
- Macintosh Specific
- Undocumented Modules
All right, it's a fair cop, but society is to blame.
This chapter shows what main module services and extensions are currently available for the Python programming language. The focus here is to expand your knowledge by introducing the most used modules and listing some examples for you.
The first chapter has given you a good introduction about the Python core language. Everything you have successfully learned will be applied from now on. All the topics covered in the previous chapters are the building blocks for your Python mastering.
Now we will concentrate on this chapter. Python's standard distribution is shipped with a rich set of libraries. These libraries intend to offer flexibility to the programmers.
The libraries (also known as modules) cover many topics, such as the following:
Python core services—A group of modules, such as sys and os, that enable you to interact with what is behind the interpreter.
Network and Internet services—Python has modules for almost everything that is Internet related. You have many network client protocol implementations that handle the most used Internet services, such as HTTP and FTP. Python also provides support for parsing mark-up languages, like XML and HTML.
Regular expressions—The re module is a very comprehensive choice for text manipulation because it provides Perl 5 style patterns and matching rules.
These are just some of the features implemented by the modules that are reviewed by this chapter.
The Library Reference
The robustness of Python's library is something amazing. Many users have contributed to the development of these modules during the last few years.
Some modules were written in C and are built into the interpreter. Others are written in Python and can be loaded by using the import command.
Keep in mind that some of the interfaces may change slightly (for instance, bug fixes) with the next release. Therefore, I suggest that you visit Python's Web site once in a while, and keep yourself up-to-date. You can always browse the latest version of the Python Library Reference at
I encourage you to use this chapter in order to get a quick overview about the existing Python libraries. After you have exhausted all the material provided by this book, check out the online Python Library Reference to see the minor details about each one of these Python module interfaces.
This chapter introduces you to the practical side of several modules' utilization. The next pages show what main functions each module exposes, and, whenever possible, some examples are listed.
Some of the modules—such as debugger(pdb), profiler, Tkinter (the standard Python GUI API) and re—aren't deeply studied here because they are presented in detail in other chapters of this book. Whenever this happens, the chapter number is mentioned next to the module name.
The Standard Library of Modules
This book covers the latest version of the Standard Library of Modules that is available at the time of this writing. The modules are presented in the same order as they are shown in Python's official documentation. This was done to make the work of cross-referencing easier for you.
The following topics are the group names that organize the modules you will find.