Keywords
Python (6)
Permissions
Viewable by Everyone
Editable by All Siafoo Users
Objects can be Added by All Siafoo Users
Hide
Stay up to dateembedded code automagically updates, each snippet and article has a feed Join Siafoo Now or Learn More

Dive Into Python Atom Feed 0

Snippets from the excellent book Dive Into Python by Mark Pilgrim.

For more information, visit http://www.diveintopython.org

Contents
Want to write shorter, cleaner code? Have an unfortunate situation where you need to fit as much as you can in one expression? Prefer a quick dose of hacks to spending the rest of your life...
Converts words to pig-latin! Also there is some cool regex magic.
Use the SGMLParser to retrieve a list of URLs from a web page.
Converts strings to their soundex equivalent. Soundex is a phonetic algorithm for indexing names by sound in English. This allows similarly-pronounced but differently-spelled words to be matched....
Call toRoman() to convert an integer to a roman numeral, or fromRoman() to convert a roman numeral to an integer....
Lets you take any input source -- URL, local pathname, network pathname, string -- and deal with it in a uniform manner. The returned object is guaranteed to have all the basic stdio read methods...
Renders Fibonacci sequences, up to a given maximum value, using a generator function.
Generates random philosophies based on the works of Kant and Husserl, thank you notes, and more using a context-free grammar....
A base class for an HTML processing module. Designed to take HTML as input and to output equivalent HTML....
Provides a framework to get filetype-specific metadata. Included is an example to parse ID3 tags (version 1) from MP3 files....
Easily and correctly pluralize most English nouns....
Pass a phone number to parsePhoneNumber, it will return a tuple of (Area Code, 3-Digit Trunk, 4-Digit Number, Extension).