I use this small code close to the head of section of my codes if I'm going to use range function to make it behave same in both python 3 and python 2
1 2 3 4
from sys import version_info as version if version.major == 2: range = xrange
It seems like this is causing problems with python earlier then 2.7, It is better to use it like this:
from sys import version_info if version_info[0] == 2: range = xrange
It seems like this is causing problems with python earlier then 2.7, It is better to use it like this: