I am Hack Sparrow
Captain of the Internets.

Archive for Python

Python: difference between urllib and urllib2

You might be intrigued by the existence of two separate URL modules in Python - urllib and urllib2. Even more intriguing: they are not alternatives for each other. So what is the difference between urllib and urllib2, and do we need them both? urllib and urllib2 are both Python modules that do URL request related stuff but offer ...

Get Python version of your System

Getting the version number of your Python installation is not as straightforward as you might have guessed. But once you get the pythonic way of doing things, the implementation starts to make sense. The way to know the Python version is thus: [code] import sys sys.version[:5] [/code] What would happen if you just do sys.version instead of sys. ...