Range() in python 2.7 v. 3 -


just wondering how same functionality out of range() in python 2.7 in version 3?

in python 2.7:

>>> range(5) [0, 1, 2, 3, 4] 

in python 3:

>>> range(5) range(0, 5) 

i need list looks 1 above, restricted using python3 assignment...

thanks much!

simply this:

list(range(5)) => [0, 1, 2, 3, 4] 

in python 3, range() returns iterable of objects, it's easy convert list, shown above.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -