Reading in strings -> numbers ??

Louis M. Pecora pecora at anvil.nrl.navy.mil
Sun Apr 30 10:33:27 EDT 2000


Bruce wrote:
>
The syntax is not equivalent in the same sense as printf vs. scanf, but
the
re module will you to parse out substrings from whatever text file
format
you are trying to read, and then eval() can be used on the components
of the
result, to turn the "fields" that are numeric strings into Python
numbers.


Bruce,

Checked out the re.py module and for me it's not transparent (I've been
at Python for on ly 3 weeks, sorry).  Would you or anyone have any
examples of doing what you suggest to read in numbers?  Thanks.



More information about the Python-list mailing list