seek() tell()

Erik Max Francis max at alcyone.com
Wed Feb 5 18:42:31 EST 2003


Peter Hansen wrote:

> I suspect the difference is because you've opened the file in
> "text mode" under Windows.  If you just do fo = open('name', 'w')
> it will be in text mode, where all linefeed characters (\n)
> are converted to carriage-return/linefeed pairs, increasing
> the size of the output by one byte per line.
> 
> If you don't want this behaviour (but under Windows you probably
> do), just open the file in "binary mode" using open('name,' 'wb).
> For more information, read the friendly manual...

Presumably you mean "rb" or "wb+", since you can't seek and tell on
files opened for write only.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ It comes from inside, and that's what I consider to be soul music.
\__/ Sade Adu
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.




More information about the Python-list mailing list