Reading in strings -> numbers ??

Louis M. Pecora pecora at anvil.nrl.navy.mil
Fri Apr 28 23:00:30 CEST 2000


Is there a Python "read-partner" for the write(string) function, e.g., 

fileobject.write(" %e %e %d" % (1.2, -3.5, 10))  

in the sense that the C functions fprintf and fscanf are partners.

I've looked in 4 different Python books and in the pdf references, but
I see nothing in read or readlines or strings that seems to make for an
easy conversion from a string to a list or tuple of objects (numbers). 
In other words, I want the opposite of the write above so I can read
those numbers back into my Python code.  

Thanks for any help.



More information about the Python-list mailing list