round numbers in an array without importing Numeric or Math?
Dan Sommers
me at privacy.net
Tue May 16 14:47:11 EDT 2006
On Tue, 16 May 2006 13:41:37 -0500,
Lance Hoffmeyer <lance at augustmail.com> wrote:
> May have a complicating issue with the array? Have
> the numbers have been interpreted as strings? I have
> been pulling them from a Word doc using regex's
> print Test
> [u'9.0', u'58.6', u'97.8', u'10.0', u'9.6', u'28.1']
Then you'll have to convert your strings to floats first:
[int(float(x)+0.5) for x in Test]
HTH,
Dan
--
Dan Sommers
<http://www.tombstonezero.net/dan/>
"I wish people would die in alphabetical order." -- My wife, the genealogist
More information about the Python-list
mailing list