PDF Reading




Apache Log Parsing

How much do I love Python? Consider this little snippet that parses Apache logs.

import re
from collections import defaultdict, named tuple

format_pat= re.compile(
   r"(?P<host>[\d\.]+)\s"
   r"(?P<identity>\S*)\s"
   r"(?P<user>\S*)\s"
   r"\[(?P<time>.*?)\]\s"
   r'"(?P<request>.*?)"\s'
   r"(?P …
more ...

Building Skills in Programming

I've revised (and streamlined) my Building Skills in Programming book. The 2.6.2. edition will simply replace the 2.6.1. edition, leading to the possibility of broken bookmarks because of the changes.

Currently, the non-programmer book accounts for under 10% hits on the http://www.itmaybeaback.com/book …

more ...

Python 2.7 CSV files with Unicode Characters

The csv module in Python 2.7 is more-or-less hard-wired to work with ASCII and only ASCII.

Sadly, we're often confronted with CSV files that include Unicode characters. There are numerous Stack Overflow questions on this topic. http://stackoverflow.com/search?q=python+csv+unicode

What to do? Since csv …

more ...


Python 3.2 CSV Module -- Very, very nice

A common (and small) task is reformatting a file that's in some variant of CSV. It could be a SQL database extract, or an export from an application that works well with CSV files.

In Python 2.x, a CSV file with Unicode was a bit of a problem. The …

more ...