how to convert string to number?

wang frank fw3 at
Tue Oct 16 20:15:06 CEST 2007

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?
今話題になってる出来事や有名人をランキングで毎週発表「MSN 気になる言葉」
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list