list of range of floats

Simon Brunning simon at brunningonline.net
Wed Feb 14 12:29:26 EST 2007


On 2/14/07, Steve <samckain at southslope.net> wrote:
> I'm trying to create a list range of floats and running into problems.
> I've been trying something like:
>
> a = 0.0
> b = 10.0
>
> flts = range(a, b)
>
> fltlst.append(flts)
>
> When I run it I get the following DeprecationWarning: integer argument
> expected, got float. How can I store a list of floats?

There would be an *enormous* number of floats between zero and ten. Do
you really want all of them in your list? I hope you have a few
terrabytes of RAM...

Or do you just want the integer values as floats?

fits = list(float(a) for a in range(0, 10))

-- 
Cheers,
Simon B
simon at brunningonline.net
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list