high-level "read" function?

Christine Celata CMCelata at lbl.gov
Mon Jun 28 16:22:06 EDT 1999


I am just starting to use Python.  It is foreign to me-- I'm a physicist
used to Fortran, not C.  I have succeeded in getting Python to read
program user input, but as far as I can see, in order to get it to read
numbers separated by commas from the terminal and store them as floating
point variables, I have to use a sequence of low-level call to:  read
the input as one character string, then strip off the carriage return,
then split the string into several strings using the commas as markers
for the end of the string, then convert the separated strings into
floating point numbers.  In the case where I am reading in strings
separated by commas the last step is omitted, but I have to add a step
to eliminate leading whitespace.  I am about to try to write a function
for myself that does all this, and a function to read integers, and a
function to read lists of strings, but--  Since lots of people must be
inputting numbers, isn't this stuff already written and lying around
somewhere?  I can't find it in the documentation for modules.   Thanks.





More information about the Python-list mailing list