Small example with Python

Python is a language that slowly is awakening my curiosity. Widely used, generally appraised and apparently powerful and yet easy to use.

After poking with it at work last friday to convert some JSON data to GeoJSON I decided to build a small tool only with Python (2.7): A script that, given a list of URLs, tells me if any of them has changed since last time it ran.

The source code of the results can be found at my Github; 83 lines of code counting (few) comments. Nothing really cool, in fact it is really simple, but it's a nice exercise as it touches some areas:

  • Methods
  • Managing Arrays (Lists in Python) and Hashmaps
  • Nulls handling ("None" here)
  • Reading and writing files, detecting if a file exists
  • Exception handling
  • JSON parsing and dumping
  • Basic HTTP requests/responses
  • Colored output

I need to learn more about this language, maybe on the inminent vacations...

Couldn't resist to add some colors, even if meant adding a library (colorama). And thanks to this I've also learned how to globally install Python libs.


Posted by Kartones on 2014-06-21