[portland] Step Value in range()
python at dylanreinhardt.com
Fri May 2 18:44:20 CEST 2008
I don't know of one off-hand... but you could add a few zeroes to your
range and divide them off with a list comprehension, ex:
[ i/1000.0 for i in range(10) ]
To get the floats 0 to .9, stepping .001
On Fri, May 2, 2008 at 9:00 AM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> Is it possible to write a range() call with a less-than-integral step?
> Specifically, I would like to call range(0.0, 100.0, 0.1). It seems this is
> not allowed; only integers need apply.
> Any way of using floats in range()?
> Richard B. Shepard, Ph.D. | Integrity Credibility
> Applied Ecosystem Services, Inc. | Innovation
> <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
> Portland mailing list
> Portland at python.org
More information about the Portland