print range in python3.3

Chris Angelico rosuav at gmail.com
Sun Jan 5 02:56:42 EST 2014


On Sun, Jan 5, 2014 at 6:38 PM, luofeiyu <elearn2014 at gmail.com> wrote:
>>>> range(1,10)
> range(1, 10)
>>>> print(range(1,10))
> range(1, 10)
>
> how can i get 1,2,3,4,5,6,7,8,9 in python3.3 ?

Are you looking for a list? That's what Python 2 returned. In Python
3, you can get that like this:

>>> list(range(1,10))
[1, 2, 3, 4, 5, 6, 7, 8, 9]

ChrisA



More information about the Python-list mailing list