built in list generator?
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue May 13 19:43:43 EDT 2008
"Diez B. Roggisch" <deets at nospam.web.de> writes:
> globalrev schrieb:
> > if i want a list with all numbers between x and y is there a way to
> > do this with an inbult function.
> >
> > i mean i can always construct a function to do this but is there
> > soemthing like:
> >
> > nbrs = list(range(50,100, 2))
>
> range *does* that. use xrange if all you want is to iterate.
Until Python 3.0, where 'range' returns an iterable.
--
\ "It seems intuitively obvious to me, which means that it might |
`\ be wrong." -- Chris Torek |
_o__) |
Ben Finney
More information about the Python-list
mailing list