how to convert string to number?

wang frank fw3 at hotmail.co.jp
Tue Oct 16 20:15:06 CEST 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071016/707e5889/attachment.html>


More information about the Python-list mailing list