Minimum and Maximum of a list containing floating point numbers
Steven D'Aprano
steve-REMOVE-THIS at cybersource.com.au
Mon Sep 6 22:31:17 EDT 2010
On Tue, 07 Sep 2010 11:00:45 +1000, Ben Finney wrote:
> If you're going to use the list of float objects, you can convert them
> all with a list comprehension.
[...]
> >>> numbers_as_float = [float(x) for x in numbers_as_str]
That's awfully verbose. A map is simpler:
numbers_as_float = map(float, numbers_as_str)
--
Steven
More information about the Python-list
mailing list