Top "Python-2.x" questions

For questions about Python programming that are specific to version 2.x of the language.

Python unexpected EOF while parsing

Here's my python code. Could someone show me what's wrong with it. while 1: date=input("Example: March 21 | What is the …

python eof python-2.x
Python division

I was trying to normalize a set of numbers from -100 to 0 to a range of 10-100 and was having …

python math python-2.x
How to pretty-print a numpy.array without scientific notation and with given precision?

I'm curious, whether there is any way to print formatted numpy.arrays, e.g., in a way similar to this: …

python numpy python-2.x pretty-print
What is the difference between range and xrange functions in Python 2.X?

Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far …

python loops range python-2.x xrange
What are the differences between the urllib, urllib2, urllib3 and requests module?

In Python, what are the differences between the urllib, urllib2, urllib3 and requests modules? Why are there three? They seem …

python python-requests urllib2 urllib python-2.x
How to get string objects instead of Unicode from JSON?

I'm using Python 2 to parse JSON from ASCII encoded text files. When loading these files with either json or simplejson, …

python json serialization unicode python-2.x
How to print a percentage value in python?

this is my code: print str(float(1/3))+'%' and it shows: 0.0% but I want to get 33% What can I …

python python-2.x
Python - write() versus writelines() and concatenated strings

So I'm learning Python. I am going through the lessons and ran into a problem where I had to condense …

python string file-io python-2.x
What is __future__ in Python used for and how/when to use it, and how it works

__future__ frequently appears in Python modules. I do not understand what __future__ is for and how/when to use it …

python python-2.x
Writing Unicode text to a text file?

I'm pulling data out of a Google doc, processing it, and writing it to a file (that eventually I will …

python unicode character-encoding python-2.x