加载中...

Python

  1. Home
  2. Computing & Technology
  3. Python

Python's Library

This is an overview of the major modules from the Python Standard Library and other major Python repositories.
Building a Whitelist for a Spam Filter
Training a spam filter can take a good deal of time and effort. Use an email whitelist to jumpstart the spam filter process. Here's how to create a whitelist of good email addresses for your spam filter.
Getting Login Information With the getpass Module
Accepting login information in plain text is inherently dangerous from the persepctive of computer security. Fortunately, Python has the getpass module which allows the handling of login information without leaving a trace in a system's cache.
Using poplib to Access a POP3 Mail Server
Whether you are coding for the Web, the desktop, or for handheld communication devices (PDAs, smartphones, etc.), being able to collect email is an important part of network programming. Here is how to use the poplib module to access a remote POP3 mailbox.
Using File Descriptors in Python's os Module
Python's os module handles much of the language's portability with respect to the local operating system. Here is how to do cross-platform system programming with Python.
Working With Python's os Module
Python's os module provides a convenient interface for many system-level operations. This overview of the module shows how to interact dynamically with the operating system and runtime environment of the Python interpreter.
Checking URLs and IP Addresses With Python's socket Module
In the Wild World of the Web, checking the DNS entry of a URL or IP address is increasingly necessary. Here is how to do it with the Python socket module
Using Shelve to Save Objects in Python
Python's shelve module is a powerful way to include persistence and to save objects in an easy-access database format. Here is how to open, assign value to, restore value from, and close shelve dictionaries and databases.
Globbing a Group of Hits
For reasons of security and the smooth-running of your program, it is a good idea to check whether an executable exists before you call it. There are two ways to do this in Python.
Issuing System Commands
Calling non-Python programs from within an application is not as easy as simply importing them like a Python module. But it is also not that complicated. Here is how to issue calls within the operating system using Python's os module.
Find Yourself With the os Module
When making a localised system call, one that does not use an absolute path name, it is important for security's sake to ensure that the program and/or its arguments actually exist in the local path. Here is how to use Python's os module to check your immediate environment.
Using Pickle to Save Objects in Python
Python's pickle module is a quick and easy way to save Python objects in a standard format. Here is how to save and restore Python objects with pickle.
Mutable Sequences
Python supports several operations that modify objects in situ. These are called mutable because no output is necessary. Here is a guide to what they are and how they are used.
Making System Calls and Running Other Programs With the os Module
Python's os module contains several very powerful functions for interacting with the operating system. Here is how to use os.system() to execute an external program from within Python.
XRange Type
Python's xrange() function is a very easy way to generate a range without consuming a lot of resources. Here is a reference to how it is used and what operations it supports.
String Formatting Operations
Python's string formatting operations are important to know for most any program that you write. Here is a comprehensive guide to them.
Sequence Types
Python supports several kinds of sequences. Here is a guide to each.
Python's Iterators
Python's iterators are very powerful and helpful. Here is a guide to the iterator protocol used in Python.
Bit String Operations
Python's bit string operations are an important part of advanced programming. Here you will find a reference to the bit-wise operators in Python.
Set Types: set and frozenset
Python's built-in set types are helpful ways to create both mutable and immutable sets of values for use in your programming. Here are the functions and methods that you can use with each.
Numeric Types and Operations
Python recognises several types of numbers. Here is a reference for the numeric types that Python knows and what you can do with them.
Comparison Operations
Python's comparison operations are pretty straightforward. Here is a reference to them with a bit of detail that you may not know.
Python Built-In Modules: Boolean Operations
Boolean operators are a significant part of Python programming. Here is a reference on how to use them.
Python Built-In Modules: Truth Value Testing
Testing values true or false is a critical part of Python programming. Here are some of the finer details of what tests as false and what tests as true in Python
Deprecated Functions in Python's String Module
Python's string module offers a bevy of functionality. Some of it, however, has been moved to the built-in string methods. Here are the functions that are deprecated.
The Python Standard Library
This page offers an overview of the most commonly used modules from the Python Standard Library. It is not intended as a replacement for the documentation. Rather, it highlights modules which factor into most general purpose programming projects.
Importing Modules
If you are unclear about how to use these library functions, you may benefit from a refresher on importing modules. This page offers a rudimentary discussion. If you want something a bit faster paced, try "Importing Modules and Assigning Values", a page out of the primer "Hello, World!": A Quick Tour of Python".
Python's Built-In Exceptions
Python's built-in exceptions are many; knowing them really helps your programming.
Python's Built-In Warnings
Python's built-in warnings are important to know. Here is a list of them.
Pythons 're' Module
Python's re module is without a doubt one of the most commonly used parts of the Python library. Remember its functions, on the other hand, is not always easy. Here is a reference to help you keep it all straight.
Pythons 're' Module: Regular Expression Objects
Python's re module is without a doubt one of the most commonly used parts of the Python library. Here is a reference of the methods and attributes available in each regex object
Pythons 're' Module: RegEx MatchObjects
Python's re module is without a doubt one of the most commonly used parts of the Python library. Here is a reference of the methods and attributes available for every match of a regular expression.
Python's socket Module (Part 1)
Python's socket module is the foundational module for all network programming in Python. Here is a reference of the functions, classes, and constants available through it.
Python's socket Module (Part 2)
Python's socket module is the foundational module for all network programming in Python. Here is a reference of the functions, classes, and constants available through it.
Python's socket Module (Part 3)
Python's socket module is the foundational module for all network programming in Python. Here is a reference of the functions, classes, and constants available through it.
Python String Methods
Python's built-in string methods are incredibly powerful. As the name implies, each of the following methods are available through class String. Every string object is an instance of that class and has these methods available. This is the first of a two-part reference on Python's built-in string methods.
Constants Provided in Python's String Module
Python's string module provides many helpful constants that you can use in your programming. Here is each of the constants and a brief description of each.
Functions of Python's String Module
Python's string module provides a couple of functions that are not available through string methods. Here they are with brief descriptions of each for your reference.
Python's String Templates
Python's string module provides a Template class to process strings powerfully and en masse. Here is a description of the methods and the single attribute of this class and an example of how to use template string objects.
The Python Library Reference
If you just want to read the documentation on the Python library, this page is for you. The Python website has a complete discussion of every module that comes with the standard installation of Python. It may be terse or obtuse at times, and not every call is discussed in detail, but this is the "standard".
The Effbot Guide to the Python Standard Library
The Python library is so vast that it is near impossible to know all attributes and all methods of all modules. Fortunately, you do not need to remember all of that. This guide by Fredrik Lundh offers a comprehensive treatment of every attribute and every method of every module in the Python Standard Library. If you would rather have the book, you can buy it from O'Reilly Media.
Object-oriented Programming and Python
If you still find yourself tempest-tossed about what object-oriented programming is and how to do it with Python, this page from Python.net offers a clearly written and well-rounded discussion on the subject. Another excellent discussion on the topic is by Matthew Reynolds at StarDeveloper.com.

Explore Python

More from About.com

New Year, New You

Take action today to accomplish your biggest goals with these motivating ideas.

Best Moves in a Bad Economy

Stay on top in this tough economy with our smart, easy-to-follow financial tips.

Python

  1. Home
  2. Computing & Technology
  3. Python
  4. Python Library

©2009 About.com, a part of The New York Times Company.

All rights reserved.