amazing anna arithmetic async brick byte cad canvas classes complete controlling cx debug del dimensions dot dump element encode encoding evolution ffffff fold ga handle historical huge implemented implied inclusion indicator json launching manipulating movements mysql numeric ordered overriding pain parse plot quantities queue relational removing requests restriction resulting rpc safely showimage snow sql stdin tensor upload winamp wx
|
See also my main Python Programming web page.
The Python Cookbook site has
many recipes for doing simple, complex and often amazing things with
Python. Two books that contain selected collections of these recipes
have also been published.
|
Python Cookbook,
(second edition) by Alex
Martelli,
Anna Ravenscroft and David
Ascher, 2005, ISBN 0596007973, O'Reilly.
This is a collected set of recipes for doing all sorts of common (and
not
so common) tasks in Python. The recipes are grouped into task-specific
chapters, so you can often just glance down the list of chapters and
then skim the contents of one or two chapters to find what you are
looking for. The recipes are usually less than a page long, often short
enough to just type into the Python interpreter shell directly to play
with, and come with a write up that will cover what the recipe does and
go into details about any additional background material you might need
to know.
If you are a lone programmer who's looking
to get productive in Python fast, this is a good book to get. Its the
sort
of thing where you could find a solution in this book in 5 minutes that
will save you a few hours of web searching and experimentation. If
you've
got a few people at work who use Python, then at least get one copy for
the office, it'll pay for itself in one use.
|
The following list contains bookmarks to the recipes I have found
useful or interesting. A lot of these are marked because the recipe
demonstrated some technique or used some language or library feature
that I felt might be useful someday, and rather than having to do a
large search at a later date I have bookmarked the artical so I have a
hope of finding it faster.
- 2010-Jul-22: An interactive
tutorial for regular expressions. An article on the essentials of regular expressions.
[753]
- 2010-Jan-29: Rsync Algorithm in Python [8944]
- 2009-Nov-13: Using a decorator to facilitate switching between main and background threads. [8748]
- 2009-Nov-05: A depth first search generator. [8710]
- 2009-Nov-05: A look at solving the Partition Partition problem with a natural selection (genetic) algorithm. [8705]
- 2009-Nov-04: An implementation of the Talbot method for numerical inversion of the Laplace Transform. A second version of this using mpmath for extended precision. [8699] [1] [2]
- 2009-Aug-13: How one might correct
typos (in URLs or words) by
looking for closest
distance matches. And a Python module called Levenshtein
to solve this. This recipe contains bktree.py which implements Fast Levenshtein distance (Wagner-Fischer algorithm) and the BK-tree. A recipe for calculating the Levenshtein distance between two strings.
[549] [1]
- 2009-Aug-04: How to shutdown a Windows PC using ctypes rather that the win32api package. [8361] [1]
- 2009-Jul-15: Using pyPdf to crop margins in a PDF document. [8275] [1]
- 2009-Jul-08: Running the Windows screen saver from Python. [8248] [1]
- 2009-Jul-08: Using ReportLab to print page X of Y into a PDF file. [8241] [1]
- 2009-Jul-01: How to redate pictures based on the date code in their EXIF information. [8208]
- 2009-Jun-23: Using PIL to add watermarks to pictures. [8182]
- 2009-Jun-16: How to copy files over SSH using paramiko. I do this sort of thing to backup some of the data on my VPS box. [8151]
- 2009-Jun-16: A command line program for sending email. [8150]
- 2009-May-28: self-logging exceptions. [8049]
- 2009-May-19: Blurring an image by convolving with a Gaussian function. [7996] [1]
- 2009-May-19: Lancos Gamma Approximation. [7995] [1] [2]
- 2009-May-19: Brownian motion of a stock, this simulates stock market price movements with a Brownian Motion model. This should generate trends that look reasonable, but lack enough infrequent, but large, movements. [7994] [1]
- 2009-May-19: Subprocess with async I/O pipes class. [7993]
- 2009-May-06: How to do calculations on huge memmap arrays. [7949]
- 2009-May-05: An implementation of a bitset. [7941]
- 2009-Apr-14: Making a PDF from a directory of images by using ReportLab. [7871] [1]
- 2009-Mar-23: An OrderedDict, OrderedSet and an OrderedSet with Weakrefs. [7773] [1]
- 2009-Mar-23: Generation of captcha without using any fonts. This uses PIL for image processing. [7772] [1]
- 2009-Mar-03: Another ordered
dictionary class. And another recipe for one (with an update for use under Python 2.7 and 3.1).
[746]
- 2009-Mar-03: Python HTTP Pipelining is an implementation of HTTP Pipelining for Python, this allows an HTTPConnection to send the next request(s) ahead of time (i.e. before the response to the previous request has been received). Now if only an HTTP server could send responses back to the client before the client makes the requests... [7675] [1]
- 2009-Feb-23: This recipe contains some examples of unit tests [7634]
- 2009-Feb-23: icmplib is a library for creating and reading ICMP packets in Python. [7632]
- 2009-Feb-23: A recipe for Waiting for a network service to appear. [7631]
- 2009-Feb-13: Adding support for the with statement for StringIO. [7581]
- 2009-Feb-13: Evolution optimization strategy presents a genetic algorithm for solving search and optimization problems. The first comment to this shows how to do the same thing with pyevolve. [7578] [1] [2]
- 2009-Feb-10: An example of using PIL to extract date information from the EXIF data found in JPEGs. [7554]
- 2009-Jan-28: Controling CPU usage by using ctypes and Get CPU usage by using ctypes. [7499] [1]
- 2009-Jan-28: Stacked graphs using matplot lib is used to create stacked or stream graphs (those graphs of how events change over time that look like a flowing stream from above - especially one that's carrying a coloured oily film with it). [7498] [1]
- 2009-Jan-22: A state machine for text processing. [7477]
- 2009-Jan-16: A recipe for implementing state machines. [7441]
- 2008-Dec-19: Sorting sections and keys in a .ini file [7377]
- 2008-Dec-16: This recipe shows how to do "dot style" dictionary look ups by using the __getitem__() special function. [7355]
- 2008-Dec-14: This SyncFiles recipe allows you to save a programs state, ensuring that the previous (good) copy is preserved and on reload checks to see if the most recent save is complete, and if not reloads an older state instead. [7343]
- 2008-Dec-03: Using the stepping stone algorithm to solve the transhipment problem, which is a cost-minimization optimization issue. [7293] [1] [2]
- 2008-Dec-03: A recipe for converting numbers into a textual representation. [7292]
- 2008-Nov-17: Walker's alias method for random objects with different probabilities. [7225] [1] [2]
- 2008-Nov-04: Convert color space from HSV to RGB and RGB to HSV [7145] [1]
- 2008-Nov-04: Named Tuples, this is a class that allows you to access the contents of tuples as if they were objects with named attributes. A similar recipe provides records which are mutable. [654] [1]
- 2008-Nov-03: Simple Web Crawler [7139]
- 2008-Nov-02: A recipe for converting MySQL database to Amazon's Simple DB. [7133]
- 2008-Oct-11: A patch for ElementTree to better support the CDATA section. [7006] [1] [2]
- 2008-Oct-05: Make any object immutable with a freeze() function and Frozen class. Also an example of the __setattr__ and __getattribute__ functions. [6988]
- 2008-Oct-04: How to find new or unreclaimed objects between two points in your Python code. [6985] [1]
- 2008-Oct-03: How to search the path for DLL and EXE files. [6979]
- 2008-Oct-02: This recipe provides a multithreaded multiplexer/demultiplexer to allow transactions to be performed in parallel on a single channel. [6970]
- 2008-Oct-01: Two recipes for calculating the date of Easter and the Liturgical Calendar Year. [6963]
- 2008-Sep-22: In Generating correlated random numbers the author applies a method described in Generating Correlated Random Numbers to generate correlated random numbers with Python. [6900] [1] [2]
- 2008-Sep-13: Using the Python Imaging Library to generate degrades letter stimuli contains examples of text rendering in PIL as well as modifying the contrast, luminance and introducing noise to an image. [6846] [1]
- 2008-Sep-11: Polynomial Explorer is a simple example of using matplotlib to plot functions and controlling this with a mouse. [6832] [1]
- 2008-Sep-09: How to get historical stock quotes from Google Finance. [6824] [1]
- 2008-Sep-04: An interruptable queue that allows either end to raise exceptions to the other end. [6801]
- 2008-Sep-04: This recipe on yet another signal/slot implementation in Python could serve as an example of weak references as implemented by the weakref module's WeakValueDictionary. [6800]
- 2008-Sep-01: A recipe for a mergeable dictionary which can be combined with another dictionary with the restriction that if the two dictionaries have keys in common, then those keys have the same values. [6780]
- 2008-Aug-30: This recipe contains a variation on the processing.Pool which allows multiple threads to send the same requests without incurring duplicate processing. [6766]
- 2008-Aug-26: This recipe demonstrates a simple windows service using the win32service module. Another recipe is here. [5306] [1]
- 2008-Aug-26: Null Object Design Pattern provides a class for a Null object that can be use in place of the None data type to simplify code and remove special case tests. [6741]
- 2008-Aug-21: This recipe allows one to automate posting to the cookbook. [6719]
- 2008-Aug-20: Creating or updating the contents of Windows shortcut files. [6709] [1]
- 2008-Aug-19: How to get the index of an element in a list using an identity (instead of equality) test. [6705]
- 2008-Aug-19: How to subclass a list and still have slicing operations work. [6704]
- 2008-Aug-19: How to modify or set an environment variable permanently on Windows from within a Python script. [6703] [1]
- 2008-Aug-14: Get a posix timestamp from a type 1 uuid [6689]
- 2008-Aug-14: Python HTTP POST binary file upload with pycurl [6688]
- 2008-Aug-13: Pad images to power-of-two dimensions uses PIL to read and pad images so they have dimensions that are exact powers of two, which might be required for some OpenGL texture map implementations. [6680] [1]
- 2008-Aug-13: Multithreaded FIFO Gate is a module that allows a set of running tasks to be paused and resumed in a coordinated fashion. [6679]
- 2008-Aug-05: [6635]
- 2008-Jul-29: Manipulating the __builtin__ dictionary to insert your own debugging functions and make them globally available without needing imports. [6604]
- 2008-Jul-29: Setting a directory's ACL on a windows domain controller using the active_directory module and the fileacl.exe program. [6603]
- 2008-Jul-18: How to list system process and process information on win32 [6545] [1]
- 2008-Jul-14: Thread pool mixin is a drop-in replacement for the ThreadingMixIn class that maintains a pool of threads for reuse rather than allocating a new thread each time another is needed. [6520]
- 2008-Jun-21: Converting XML to Dictionary and Back, the intent of this is to make working with XML structured data easier for the Python programmer. While this is not a general solution for all XML data files it may be useful for things where the structure and content is more restricted, like a configuration file. [6400] [1] [2]
- 2008-Jun-17: Using OpenSSL to provide
SSL support to an XMLRPCServer. This gets used and reworked here.
[752]
- 2008-Jun-05: A recipe for a threaded documenting XML RPC server over HTTPS, this makes used of pyOpenSSL [6287] [1]
- 2008-May-27: How to read a continuous stream of PPM frames as output by ffmpeg. [6243] [1]
- 2008-May-20: portalocker a cross-platform file locking module. [6202]
- 2008-May-12: RSA is an implementation of some of the RSA algorithms in Python. [6140] [1]
- 2008-May-08: Play a PLS audio stream in Windows Media Player, this recipe will convert a PLS format play list file into the XML format (ASX) that WMP wants and then start WMP to play it. [6073]
- 2008-May-08: TV-Series Current Info, this recipe will get the airing dates for a particular TV show using IMDbPY. [6072] [1]
- 2008-May-02: Using the win32file module to quickly determine the size of directory trees. [6032] [1]
- 2008-Apr-29: In Print Tkinter canvas without a postscript printer the author uses the win32ui module to create a device context on a Windows supported printer and then draws to it to get printed output. [5999] [1] [2]
- 2008-Apr-25: Recreate MS Access table in SQLite, this has some limitations but could be used to help migrate data from one database to another. Also includes some use of the win32com API to get at the Access database. [5968] [1] [2]
- 2008-Apr-25: Multithread support for SQLite access, a work around to an SQLite limitation. [5967] [1]
- 2008-Apr-21: The pisa (home page here) module uses the ReportLab toolkit to create PDF files from HTML and CSS input. This recipe is an example of using pisa. [4141] [1]
- 2008-Apr-19: PathCatcher is a Windows utility that allows one to right-click on a file or folder or selected group of files in Windows FileExplorer and save its path to the clipboard. Probably a good place to start if you want to write some simple extensions to the FileExplorer. [5933] [1]
- 2008-Apr-11: A simple Python script to backup files in a directory tree. [5768] [1] [2]
- 2008-Apr-10: How to capture and do nothing (i.e. block) on the use of special keyboard keys (like the Windows key). This example is specific to pygame. [5763]
- 2008-Apr-03: How to list classes, methods and functions in a module using the inspect module. [5384] [1]
- 2008-Apr-03: Automate CATIA V5 with Python and Pywin32 is a simple example of the win32com.client module. [5385] [1]
- 2008-Apr-03: A JSON RPC client and server pair. Ian Bicking thinks that doing this with WebOb makes more sense and provides a tutorial here. [5375] [1]
- 2008-Mar-23: A gzip pipe for asynchronous use that allows you to read a large file in small chunks. [5326]
- 2008-Mar-23: Transactional Objects, a class that allows changes to be committed or rolled back. [5325] [1]
- 2008-Mar-19: Introspecting call arguments, a recipe that implements in Python the algorithm the interpreter uses for passing and assembling the arguments to functions. [5307] [1]
- 2008-Mar-12: Treat the Win32
Registry like a Python dictionary. This is updated here.
[756]
- 2008-Mar-03: This recipe allows you to create a restricted python function from a string, the intent being to allow an application to be safely scripted by user written functions in a controlled fashion. A cautionary follow-up to this which mentions that the rexec function is known to have security issues and is being removed from Python. [5206] [1]
- 2008-Mar-01: A class for extraction and manipulation of data from Microsoft Access. [5200] [1]
- 2008-Feb-26: Search for the maximum value in each row of a matrix that is known to be totally monotone. [5167] [1] [2]
- 2008-Feb-25: A recipe for modifying the Windows registry that creates simple data files and feeds them to the "reg" command line tool. [5155] [1]
- 2008-Feb-22: This recipe uses PEP 263 to extend the syntax of the Python language. [5141] [1]
- 2008-Feb-12: Pickle optimizer examines Python pickles and eliminates unused PUT opcodes, resulting in smaller pickles. [5087] [1]
- 2008-Feb-05: A recipe to determine the size in bytes of objects. [5049]
- 2008-Jan-24: A file contents caching system that appears as a dictionary where setting new values into the dictionary cause them to be written to disk file storage and reading values from the dictionary cause them to be loaded from the dictionary unless the key is not present, in which case they are fetched from disk. [4987] [1]
- 2008-Jan-21: Chomsky,
you too can now generate reams of important sounding text, for your
next scientific paper, SPAM project or as a test driver. This gets used here to generate testing data.
[667]
- 2008-Jan-18: A simple genetic algorithm [4961] [1] [2]
- 2007-Dec-19: A short recipe that illustrates how to create an n-dimensional dictionary where you can set a new key-value pair at an arbitrary level of nesting with simple code by using the __getitem__() and setdefault() functions. Note: this is best used by assuming your object tree is always N-dimensional and that N is constant for all values, otherwise you may encounter an error. Consider:
>>> class auto_dict(dict):
... def __getitem__(self, key):
... return self.setdefault(key, self.__class__())
...
>>> d = auto_dict()
>>> d["foo"]=1
>>> d
{'foo': 1}
>>> d["bah"]["bug"] = 2
>>> d
{'foo': 1, 'bah': {'bug': 2}}
>>> d["bah"]["bug"]["big"] = 3
Traceback (most recent call last):
File "", line 1, in ?
TypeError: object does not support item assignment
>>> d["xbah"]["xbug"]["xbig"] = 3
>>> d
{'xbah': {'xbug': {'xbig': 3}}, 'foo': 1, 'bah': {'bug': 2}}
>>> d["xbah"]["bug"]["big"] = 3
>>> d
{'xbah': {'xbug': {'xbig': 3}, 'bug': {'big': 3}}, 'foo': 1, 'bah': {'bug': 2}}
>>>
[4472] [1] - 2007-Dec-12: A stock market checking application that gets its data from finance.google.com. The user interface is written with PythonCard. [4416] [1]
- 2007-Dec-11: A class for propagating uncertainties in numeric quantities through a series of calculations. [4414]
- 2007-Dec-06: An example
of using pyPdf to extract text from PDF files
[817] [1]
- 2007-Dec-06: An example of creating a greeting card with ReportLab and PIL. [4398]
- 2007-Dec-05: A finite state machine module which includes an RPN expression evaluator as an example. [4394]
- 2007-Nov-27: A dependency graph generator, this requires some additional tools to function, but should work on Windows. [4201]
- 2007-Nov-12: A recipe for submitting multiple concurrent batch jobs, using the os.system() call in separate threads to take advantage of a multi-processor system. [4072]
- 2007-Nov-06: Using gzip module to zip a file. [4034]
- 2007-Oct-30: Enhanced safe string formating. [3901]
- 2007-Oct-29: A function to generate a regex expression for a range of numbers like: 1995-2000. Sounds like an application of purest evil. [3764]
- 2007-Oct-29: twizzler, a command line progress indicator. [3763]
- 2007-Oct-26: A basic POP3 mail server written in Python, useful as a test platform. [3517]
- 2007-Oct-22: XML to Python Data Structure, this allows an XML object to be easily accessed as a python object (with some minor limitations). [3500] [1] [2]
- 2007-Oct-03: A simple LED component for wxPython displays. It has some cute use of ASCII art to encode the actual image data, a more complete example of this XPM format can be seen here. My version of wx.Colour did not have the GetAsString() function, so I wrote a trivial replacement:
def getAsXPMRGB(wxcolour):
return "#%02x%02x%02x" % wxcolour.Get()
[2423] [1] - 2007-Sep-30: PyDbLite, a small in-memory database engine [2408] [1]
- 2007-Sep-30: pyText2Pdf, a Python script to convert pain text directly into PDF documents. [2407] [1]
- 2007-Sep-20: Picking an unused port. [2230]
- 2007-Sep-11: The Bitsort Algorithm, which can be used to sort a file full of integer numbers. [1878]
- 2007-Aug-29:
Some functions for simple Windows
Registry IO
[833]
- 2007-Aug-29:
PythonCall,
allows Python functions to be called from the command line, this also
contains some Windows registry manipulation code.
[832]
- 2007-Aug-29:
PathCatcher,
uses the Win32api (via ctypes) to add a right mouse button popup menu
association to some Python code
[831]
- 2007-Aug-29:
Class
for writing content to Excel and formatting it, this is done using
the win32com.client module
[830]
- 2007-Aug-29:
Extraction
class for Microsoft Access, makes getting data out of a Microsoft
Access database easy
[829]
- 2007-Aug-29:
How to modify the Windows Registry to make persistent
changes to environment variables
[828]
- 2007-Aug-29:
Invert
a dictionary by swapping its keys and values
[827]
- 2007-Aug-29:
icmplib:
library for creating and reading ICMP packets, this is intended for
low level network using raw sockets.
[826]
- 2007-Aug-29:
This recipe emulates
the defaultdict class from Python 2.5 in Python 2.3
[825]
- 2007-Aug-29:
xml
reverse-engineering ElementTree code generator, I guess this builds
Python code to work with a particular XML file
[824]
- 2007-Aug-29:
PIL
and Tkinter to display images, a simple image display script
[823]
- 2007-Aug-29:
Upgradable
Pickles, an approach to allowing older pickled data to be loaded by
an updated version of the code
[822]
- 2007-Aug-29:
K
fold cross validation partition, how to take a set of data and
split it up into a training set and a validation set
[821]
- 2007-Aug-29:
Journal
Dictionary and Mixin for Transactions, a dictionary type class
where the changes to values in it are journaled allowing them to be
rolled back until being committed. Also has some discussion of the undo
problem.
[820]
- 2007-Aug-29:
Generic
Block Iterator, looks a breaking up long strings and iterating over
the parts
[819]
- 2007-Aug-29:
A discussion of Interleaving
Sequences, some of the comments are quite informative
[818]
- 2007-Aug-29:
Simple
maps and lists from XML, uses ElementTree to import XML into Python
collections
[816]
- 2007-Aug-29:
Adding
an account to a group in active directory
[815]
- 2007-Aug-29:
Dump all active
directory information using LDAP
[814]
- 2007-Aug-29:
A recipe for downloading
stock market prices from Yahoo
[813]
- 2007-Aug-29:
A threadpool
implementation
[812]
- 2007-Aug-29:
Calculating the start
and end dates of particular weeks in the year, this recipe starts
with the hard way and in the comments a much easier way is discussed
[811]
- 2007-Aug-29:
Using a dictionary as a priority
queue
[810]
- 2007-Aug-29:
Importing
ARFF format data files into an SQL database, an example of using
the pyparsing and SQLAlchemy modules
[809]
- 2007-Aug-29:
Adding the ability to pushback
values onto an iterator
[808]
- 2007-Aug-29:
A rotating
log file handler with compression
[807]
- 2007-Aug-29:
Another Unique()
function.
[806]
- 2007-Aug-29:
A simple and efficient way of creating
records (structs) where each argument to the constructor becomes an
attribute of the object
[805]
- 2007-Aug-29:
A module for running
simple proxies and an example
of its use.
[804]
- 2007-Aug-29:
Cataloging
and adding IPTC keywords to digital photos based on the EXIF data
from each JPG file
[803]
- 2007-Aug-29:
basic
authentication and cookie handling in an xmlrpc server and client
[802]
- 2007-Aug-29:
A digest
authentication handler in Python
[801]
- 2007-Aug-29:
Using
PyXPCOM to handle IDN, demonstrates how to use some of the Mozilla
XPCOM cross-platform component object model services from Python
[800]
- 2007-Aug-29:
Using
ctypes to call functions from the Winamp plugin DLLs to provide MP3
playback from in Python
[799]
- 2007-Aug-29:
Walk
the directory tree of an FTP site.
[798]
- 2007-Aug-29:
Calculating the Hamming
distance between two strings
[797]
- 2007-Aug-29:
Locating
all instances of files that match a pattern thoughout a directory
tree
[796]
- 2007-Aug-29:
Finding
all the instances of a substring in a given string
[795]
- 2007-Aug-29:
Accessing
a cairo graphics surface from numpy for use in pygame.
[794]
- 2007-Aug-29:
An ISIN
Validator, ISIN are the International Securities Identifying
Numbers, see this Wikipedia artical
[793]
- 2007-Aug-29:
A simple
function base genetic algorithm in Python which is a solution to
the first problem in this Genetic Algorithms
in Plain English tutorial.
[792]
- 2007-Aug-29:
Making str()
work with the contents of lists
[791]
- 2007-Aug-29:
Calculating a distance
matrix using scipy
[790]
- 2007-Aug-29:
Implementing the composite
design-pattern using dictionaries
[789]
- 2007-Aug-29:
Weighted
choice using the cumsum() function from numpy
[788]
- 2007-Aug-29:
Another Odict
implementation, a dictionary that preserves the object insertion
order
[787]
- 2007-Aug-29:
Find a windows
hostname given the username - find the name of the computer that a
user is logged into
[786]
- 2007-Aug-29:
A simple
lockfile to ensure only one instance of an application runs at a
time, this uses the __del__() method to ensure clean up is done properly
[785]
- 2007-Aug-29:
Iterator
merge, a memory efficient multi-way iterator merge
[784]
- 2007-Aug-29:
A higher
level wrapper for the struct module that should make it easier to
use
[783]
- 2007-Aug-29:
A higher level API for manipulating
the registry
[782]
- 2007-Aug-29:
More on using the winreg
module
[781]
- 2007-Aug-29:
Another example of how
to use the winreg module.
[780]
- 2007-Aug-29:
An example of how
to use winreg, this prints out as much as possible about the user's
registry.
[779]
- 2007-Aug-29:
A simple
tensor class
[778]
- 2007-Aug-29:
An Octree
implementation in Python
[777]
- 2007-Aug-29:
Convert
a formula string with implied multiplication to propper form
[776]
- 2007-Aug-29:
Convert
10 digit ISBN numbers to 13 digit numbers (which will be effective
in 2007)
[775]
- 2007-Aug-29:
Automatically split up text
that contains a table
[774]
- 2007-Aug-29:
Recursively look
up groups in Active Directory
[773]
- 2007-Aug-29:
Various
ways of sorting and the differences between Python 2.3 and 2.4
[772]
- 2007-Aug-29:
Finding
the value passed for a particular parameter to a function by name
[771]
- 2007-Aug-29:
Controlling the Lego Mindstorm
NXT brick from Python via bluetooth
[770]
- 2007-Aug-29:
Implementing an immutable
dictionary by overriding the modification methods of a dictionary
[769]
- 2007-Aug-29:
Building a compressed, self-extracting
executable script for UNIX
[768]
- 2007-Aug-29:
Find the various atoms (tags) contained in an MP4
file
[767]
- 2007-Aug-29:
Download satellite
images of earth from NASA
[766]
- 2007-Aug-29:
Allow one thread to raise
exceptions in the context of another
[765]
- 2007-Aug-29:
A foldable
panel with a Windows XP look and feel in wxPython
[764]
- 2007-Aug-29:
Converting a directory full of
PNG images into an images.py module st they can be loaded from
strings into wxPython
[763]
- 2007-Aug-29:
ColumnSorterMixIn with a Virtual
wx.ListCtrl
[762]
- 2007-Aug-29:
An object-relational-mapper
for Python that behaves like Ruby's ActiveRecord
[761]
- 2007-Aug-29:
Using EventQueue
to mediate access to shared resources between multiple threads
[760]
- 2007-Aug-29:
Inverting
a dictionary
[759]
- 2007-Aug-29:
Adding
support for "in" to the minidom elements
[758]
- 2007-Aug-29:
Determining
server uptime for Windows 2000/NT/XP, this executes a "net
statistics" command as a subprocess and pipes the output into the
Python script for analysis
[757]
- 2007-Aug-29:
Screen
scraping using the parser component of Internet Explorer
[755]
- 2007-Aug-29:
Extracting
elements with id attributes from HTML
[754]
- 2007-Aug-29:
Setting the priority
of a process in Windows
[751]
- 2007-Aug-29:
Weak attribute references
[750]
- 2007-Aug-29:
An in-memory
database engine in 200 lines of Python
[749]
- 2007-Aug-29:
An example of using the Blowfish
encryption from pycrypto
[748]
- 2007-Aug-29:
Some additional string
manipulation functions
[747]
- 2007-Aug-29:
A simple personal
finance tracker using sqlite for storage
[745]
- 2007-Aug-29:
A restricted
(safe) eval, for dynamically executing Python scripts
[744]
- 2007-Aug-29:
Python implementation of the
XTEA block encryption algorithm
[743]
- 2007-Aug-29:
Templite,
a light-weight general purpose templating engine
[742]
- 2007-Aug-29:
Conversion of OLE
datetime to Python datetime
[741]
- 2007-Aug-29:
Resolving Windows shortcuts
to directories
[740]
- 2007-Aug-29:
Using win32file to copy
large files to avoid excessive clearing of the Windows file cache
(the KB98756
article on this)
[739]
- 2007-Aug-29:
A simulation of a disk
file system in Python. This is the last part in a multi-part series
of recipes.
[738]
- 2007-Aug-29:
The great
circle distance formula used in computing distances between zip
codes. Here is another
example, using this to calculate the distance between zip codes.
[737]
- 2007-Aug-29:
How to flatten
highly recursive data structures for storage/retrieval
[736]
- 2007-Aug-29:
Implementation of relational
join algorithms in Python
[735]
- 2007-Aug-29:
a better super()
function
[734]
- 2007-Aug-29:
a function for inspecting
the default values for arguments to functions.
[733]
- 2007-Aug-29:
using PIL to dynamically
generate labels as images
[732]
- 2007-Aug-29:
Port
Forwarding and another
recipe for it that does this asynchronously
[731]
- 2007-Aug-29:
Reading Microsoft Excel
files
[730]
- 2007-Aug-29:
YARW,
Yet Another Registry Wrapper
[729]
- 2007-Aug-29:
Using the Python code parser to parse
(in and out) XML
[728]
- 2007-Aug-29:
Fixing Thunderbird's LDIF
export with Python
[727]
- 2007-Aug-29:
Encoding images
into strings for inclusion in your source code.
[726]
- 2007-Aug-29:
Some examples
of what to use the reduce function for
[725]
- 2007-Aug-29:
First
and last days of the month
[724]
- 2007-Aug-29:
HTTP
upload using POST of multipart form data
[723]
- 2007-Aug-29:
Getting all email
addresses for active users on a Windows Exchange Server (using
ADODB.Connection)
[722]
- 2007-Aug-29:
Evaluating
expressions using the compiler.parse
[721]
- 2007-Aug-29:
Python database interface for MS
SQL server
[720]
- 2007-Aug-29:
A dictionary subclass that will do a fuzzy
lookup to get the best match if an exact match is not found.
[719]
- 2007-Aug-29:
Redirecting standard
error, as well as stdin and stdout for remote debugging
[718]
- 2007-Aug-29:
A thread
synchronization class called sync.
[717]
- 2007-Aug-29:
Placing an animated icon into the system
tray (using wxPython)
[716]
- 2007-Aug-29:
Directly reading
the contents of disk drives from within Python.
[715]
- 2007-Aug-29:
Use a try/finally block to control
tread switching (mainly useful for inserting simple debug but
becomes more official in Python 2.5)
[714]
- 2007-Aug-29:
Using terminfo
for portable color output and cursor control
[713]
- 2007-Aug-29:
Gaussian
Blur style drop shadows with PIL
[712]
- 2007-Aug-29:
Cut
and paste of HTML format data via the Windows clipboard
[711]
- 2007-Aug-29:
A simple
way to interact with Python via HTTP
[710]
- 2007-Aug-29:
Using a windows MUTEX to ensure only a single
copy of an application can be run at one time.
[709]
- 2007-Aug-29:
Setting
up a simple HTTP server for SSL communications
[708]
- 2007-Aug-29:
Lazy
module imports, allow you to delay the actual import until the
module is actually needed
[707]
- 2007-Aug-29:
A simple async HTTP
server
[706]
- 2007-Aug-29:
Playing with the raw
input key stream on Windows.
[705]
- 2007-Aug-29:
Writing
reports using a finite state machine
[704]
- 2007-Aug-29:
Sending
HTML email with embedded images.
[703]
- 2007-Aug-29:
A simple wxPython
GUI that allows one to enter and run bits of Python code.
[702]
- 2007-Aug-29:
Running parameterized
map, filter, reduce and extract functions on a list of tuples.
[701]
- 2007-Aug-29:
How to get at the system
environment variable list in Windows
[700]
- 2007-Aug-29:
A dictionary
class that allows for attribute style access to the data, and another
variation of this idea
[699]
- 2007-Aug-29:
How to make
a thread
[698]
- 2007-Aug-29:
Sorting
nested lists
[697]
- 2007-Aug-29:
Using closures to simplify
sorting
[696]
- 2007-Aug-29:
A simple approach to logging
exceptions
[695]
- 2007-Aug-29:
A directed
graph container
[694]
- 2007-Aug-29:
A 40bit
GUID generator. A similar thing is the UUID
generator
[693]
- 2007-Aug-29:
A dictionary that maps
data intervals to objects
[692]
- 2007-Aug-29:
Make POV Ray Tracer objects from Python
script
[691]
- 2007-Aug-29:
A wrapper class to make doing some regular
expression stuff easier.
[690]
- 2007-Aug-29:
How to make a "reference
type" variable in Python, though you probably should never do this
[689]
- 2007-Aug-29:
Combining BitTorrent
with Twisted
[688]
- 2007-Aug-29:
Formatting the current
exception and stack trace
[687]
- 2007-Aug-29:
Email
Python tracebacks automatically
[686]
- 2007-Aug-29:
How to setup a simple
HTTP server that supports SSL communications
[685]
- 2007-Aug-29:
win32
process information
[684]
- 2007-Aug-29:
A memory compacted list
of bits (allowing a byte of memory to hold 8 bits)
[683]
- 2007-Aug-29:
A list
mixin, this is used to add the standard list-class functionality to
your own classes
[682]
- 2007-Aug-29:
Run
two instances of the Windows file Explorer side by side (a useful
example of the win32 interface)
[681]
- 2007-Aug-29:
Extensible object
to XML converter
[680]
- 2007-Aug-29:
Reading and writing the Windows
registry
[679]
- 2007-Aug-29:
Changing a NT password
from Python
[678]
- 2007-Aug-29:
Some examples of using the Windows
Script Host (WSH) from within Python
[677]
- 2007-Aug-29:
Controlling Windows services
[676]
- 2007-Aug-29:
Manipulating the Windows environment
variables
[675]
- 2007-Aug-29:
Reading data from ZIP
files
[674]
- 2007-Aug-29:
Reporting free
drive space on Windows
[673]
- 2007-Aug-29:
Refreshing the windows
desktop
[672]
- 2007-Aug-29:
Arbitrary
precision binary floating point arithmetic
[671]
- 2007-Aug-29:
some support
classes for IP4 networking
[670]
- 2007-Aug-29:
using asynchronous
subprocesses on Windows and POSIX
[669]
- 2007-Aug-29:
Launching BitTorrent
[668]
- 2007-Aug-29:
two_way_dict,
a dictionary like object that has reverse lookup as well
[666]
- 2007-Aug-29:
dictproperty,
properties for dictionary attributes - an attribute that is accessed
like a dictionary but is implemented using method calls.
[665]
- 2007-Aug-29:
Removing duplicates
from a list
[664]
- 2007-Aug-29:
a bag
collection class similar to the one in SmallTalk (or MultiSets in
C++ or Haskell's Edison module)
[663]
- 2007-Aug-29:
a dictionary that can remember multiple
values for each key
[662]
- 2007-Aug-29:
an ordered
dictionary
[661]
- 2007-Aug-29:
Testing strings to see if they are identifiers
[660]
- 2007-Aug-29:
A strip
chart plotter
[659]
- 2007-Aug-29:
sending
data in ICMP packets
[658]
- 2007-Aug-29:
logger,
a module for logging error messages
[657]
- 2007-Aug-29:
SetFileTime
allows one to ser created, accessed and written file times
[656]
- 2007-Aug-29: Watch
a directory for changes to files on Windows. Here is how to do this
on UNIX.
[655]
- 2007-Aug-29: A class for writing content to Excel and formatting it, this recipe uses the win32com module to access and control Excel. [597] [1]
- 2007-Aug-27: Convert Microsoft Office documents to PostScript (or PDF) using an installed printer driver and win32com. [584] [1] [2]
- 2007-Aug-27: Using the win32com module to automate the CATIA CAD software package with Python. [583] [1]
|