file.read problem
Fredrik Lundh
fredrik at pythonware.com
Fri Feb 17 03:57:36 EST 2006
"wscrsurfdude" wrote:
> >Try opening the file in 'rbU' mode. This will use universal newline mode
> >and convert all carriage returns to line feeds.
>
> I tried this, but as you say, now there are 0x0A bytes extra in my
> files, is there also a possibility to let all these things out, and
> just get the file.
>
> 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.
what kind of file are you reading? if it's a text file, it's supposed to have
LF in it (or CR LF if you read it in binary mode); the LF:s are there to tell
you where each line ends.
if it's a binary file, open with mode "rb".
</F>
More information about the Python-list
mailing list