By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,543 Members | 899 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,543 IT Pros & Developers. It's quick & easy.

Re: Convert string to array of floats

P: n/a
Le Thursday 19 June 2008 17:12:08 Jonno, vous avez Ă©critÂ*:
Hi,

I'm very new to programming and python.

I need to convert a string like this:
' 0.906366 2.276152 0.013369 80.773141
0.002836 -107.335197 0.011462 86.846290 \n'
to an array of floats.
string = '0.906366 2.276152 0.013369 80.773141'
array = [float(s) for s in string.split()]

--
CĂ©dric Lucantis
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.