I spend a lot of time hacking around in Python, and lately in R. Here are some things I’ve learned, or relearned repeatedly.
Python and Unicode
My single biggest frustration in working with Python is the arcane support for Unicode. If you’re hacking in the shell and Unicode is giving you fits, this may help:
# reading a unicode string text = open('foo.html').read().decode('utf8') # printing that string print text.encode('utf8')