19th
tip: python
quick and easy way to remove non-ascii characters from a string: filter(lambda c: ord(c)
quick and easy way to remove non-ascii characters from a string: filter(lambda c: ord(c)
to create a nested defaultdict of defaultdicts, use d = defaultdict(lambda : defaultdict(int)) http://bit.ly/tUbev
return rows as dicts with mysqldb using the DictCursor class http://bit.ly/56bBm
use a join wrapped around a list comprehension for fast string appends http://bit.ly/K4vsr
quick fix to print with unicode characters replaced by ?: print repr(uni.encode(‘ascii’,’replace’)) http://bit.ly/kT4KX
use codes.open(filename,mode,encoding) to read/write with transparent encoding/decoding for, e.g. unicode http://bit.ly/16mfnU
use dir(x) or x.__dict__.keys() to get a list of fields an object or module defines http://bit.ly/UAVN
use the tempfile module to generate temporary files and directories http://bit.ly/IuEMU
use optparse as an advanced alternative to getopts for options parsing http://bit.ly/MaYfq
use StringIO (unicode, slower) and cStringIO (ascii only, faster) to treat strings as file streams http://bit.ly/Aqf2y