Tuesday, July 21st, 2009
(This is almost too stupid to post, but on the off chance that someone actually needs something like this…) I needed to interface with a bunch of data that had PHP wrapper classes, and needed a quick way of being able to interface with PHP from Python. (At this point, you might find it hard [...]
Posted in coding | 3 Comments »
Thursday, March 19th, 2009
For comparison purposes, I was rewriting the silly little e-mail digest program in Haskell, using Python libraries for the IMAP interface (it’s available on Github). It’s hard to beat Python’s amazing collection of libraries. Cabal / hackage isn’t bad, but it doesn’t yet approach Python’s “batteries included” philosophy and ease of use. Anyway, I couldn’t [...]
Posted in coding, haskell, python | No Comments »
Wednesday, February 25th, 2009
I will be updating this as I go… but see also the Wikipedia page on string functions in various languages. Joining a string list [code lang='haskell'] -- Python: ",".join(lst) -- either... import Data.List intercalate "," lst -- or... import Data.List concat (intersperse "," lst) [/code] Splitting on a string [code lang='haskell'] -- a.split(ss) -- You [...]
Posted in coding, haskell | No Comments »
Sunday, December 28th, 2008
There should be a word for “effort undertaken even though you’re sure, somewhere, somebody has written something for it already, or maybe it’s already a Linux command.” I get the distinct feeling that this utility already exists, but I googled to no avail. I have a bunch of e-mail boxes, some incredibly infrequently used, but [...]
Posted in coding | 2 Comments »
Saturday, September 27th, 2008
Just a quick snippet, since it is obvious after writing it but was not obvious while searching for it: [code lang="python"] html = file("whatever.html") soup = BeautifulSoup(html) t = soup.find(id=label) dat = [ map(str, row.findAll("td")) for row in t.findAll("tr") ] [/code] … or, map a different function is you need to further parse the individual [...]
Posted in coding | 4 Comments »