list of range of floats

Steve samckain at southslope.net
Wed Feb 14 13:13:14 EST 2007


On Wed, 14 Feb 2007 17:29:26 +0000, Simon Brunning wrote:

> 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))

After re-reading my original post I was pretty vague. I'm trying to creat
a list of ranges of floats, 0.0 10.0, 11 20, etc then checking to see if
an float, example 12.5 falls in the list and if so get the list index of 
where it is in the index. Does this make sense?

Steve



More information about the Python-list mailing list