for with decimal values?
Arnaud Delobelle
arnodel at googlemail.com
Sat May 2 12:35:16 EDT 2009
Esmail <ebonak at hotmail.com> writes:
> Hello all,
>
> Is there a Python construct to allow me to do something like
> this:
>
> for i in range(-10.5, 10.5, 0.1):
> ...
>
> If there is such a thing already available, I'd like
> to use it, otherwise I can write a function to mimic this,
> but I thought I'd check (my search yielded nothing).
>
> Thanks,
> Esmail
In this particular example, you could do this:
for i in range(-105, 105):
i = 0.1*i
...
In general, you'd have to write your own (generator) function.
--
Arnaud
More information about the Python-list
mailing list