Tuesday, 2 December 2014

Automate the boring stuff with Python

A few weeks ago I found out that Al Sweigart is preparing a new book. I decided to send him an email to ask for a draft version and, surprise, surprise, he did send it to me! Unfortunately I have not had as much spare time as I thought I would, but I have finally started reading some chapters. Looks like I will have to wait till March for the paper version though.

Something I've been wanting to do for some time was a word cloud of my blog posts. But downloading 700 posts manually was never in my head (well, almost never). Enter Al´s book and python. Following some simple instructions from the Web Scraping chapter, I have written a fifty-line program that automatically downloads every post from my blog into a single text file. From there to the chart below there is a very small step.


No comments: