How-to articles, tricks, and solutions about PYTHON-2.X
How to return dictionary keys as a list in Python?
In Python, you can use the dict.keys() method to return a view object that contains the keys of a dictionary.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)
This error is raised when trying to encode a Unicode string using the ASCII codec, and the string contains a character that is not within the ASCII range (0-127).
What exactly do "u" and "r" string prefixes do, and what are raw string literals?
In Python, the "r" prefix before a string denotes that it is a raw string literal.
What is __future__ in Python used for and how/when to use it, and how it works
The __future__ module in Python allows you to enable new language features which are not compatible with the current version of Python.
What is the difference between dict.items() and dict.iteritems() in Python2?
In Python 2, dict.items() returns a list of the dictionary's key-value pairs, whereas dict.iteritems() returns an iterator over the dictionary's key-value pairs.
What is the difference between range and xrange functions in Python 2.X?
In Python 2.X, range and xrange are used to generate a sequence of numbers.