drife wrote: > Hello, > > Making the transition from Perl to Python, and have a > question about constructing a loop that uses an iterator > of type float. How does one do this in Python? > > In Perl this construct quite easy: > > for (my $i=0.25; $i<=2.25; $i+=0.25) { > printf "%9.2f\n", $i; > }
<=Py2.3: for i in [x/4.0 for x in xrange(1, 10)]: print "%9.2f" % i Py2.4: for i in (x/4.0 for x in xrange(1, 20)): print "%9.2f" % i Reinhold -- http://mail.python.org/mailman/listinfo/python-list