L
les_ander
Hi,
matlab has a useful function called "textread" which I am trying to
reproduce
in python.
two inputs: filename, format (%s for string, %d for integers, etc and
arbitary delimiters)
variable number of outputs (to correspond to the format given as
input);
So suppose your file looked like this
str1 5 2.12
str1 3 0.11
etc with tab delimited columns.
then you would call it as
c1,c2,c3=textread(filename, '%s\t%d\t%f')
Unfortunately I do not know how to read a line from a file
using the line format given as above. Any help would be much
appreciated
les
matlab has a useful function called "textread" which I am trying to
reproduce
in python.
two inputs: filename, format (%s for string, %d for integers, etc and
arbitary delimiters)
variable number of outputs (to correspond to the format given as
input);
So suppose your file looked like this
str1 5 2.12
str1 3 0.11
etc with tab delimited columns.
then you would call it as
c1,c2,c3=textread(filename, '%s\t%d\t%f')
Unfortunately I do not know how to read a line from a file
using the line format given as above. Any help would be much
appreciated
les