file.read problem

wscrsurfdude mark at holmes.nl
Fri Feb 17 03:15:31 EST 2006


Farshid Lashkari wrote:
> > I am working on a script to get parts of raw data out of a file, and
> > the data I read has to be the data written in the file without CR or
> > LF.
>
> So you just want to remove all the linefeeds? This should work then:
>
> data = data.replace('\n','')
>
> -Farshid

The problem is if I remove the linefeeds, I also delete readout data if
it is 0x0A, and I don't want this, because the files I readout has to
be a part of the original data. Another idea??

But still my question is why is the:
f = open('myfile,'r')
a = f.read(5000)
working in linux??




More information about the Python-list mailing list