how to convert string to number?

wang frank fw3 at hotmail.co.jp
Tue Oct 16 17:34:16 EDT 2007


It seems that I have problem with the python-list, so I resend this.
 
Thanks
 
Frank


From: fw3 at hotmail.co.jpTo: python-list at python.orgSubject: how to convert string to number?Date: Tue, 16 Oct 2007 18:15:06 +0000


Hi, I have struggling to efficiently convert a string list to number. Here is my problem. I have a file that contains lines such as: data_1 1 1 2 3.5 After I read the data from the file by using readlines(), each line contains a string. I use the re moduel to split the line into ['data_1', '1','1','2','3.5']. I want to create a dictionary which contains {'data_1':[1 1 2 3.5]} The problem is I coud not efficiently find a way to convert the string to number.  Does anyone know how to create such dictionary efficiently? thanks Frank

今話題になってる出来事や有名人をランキングで毎週発表「MSN 気になる言葉」 http://keyword.jp.msn.com/default.aspx 
_________________________________________________________________
MSNミュージックとEMI Artistsが共同開催するオーディション SCHOOL OF SCHOOL
http://music.jp.msn.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071016/904d8ac3/attachment.html>


More information about the Python-list mailing list