Writing binary to stdout

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Wed Jun 23 08:29:30 CEST 2004


Paul Watson wrote:
> How can I write lines to stdout on a Windows machine without having '\n'
> expanded to '\r\n'.
> 
> I need to do this on Python 2.1 and 2.3+.
> 
> I see the msvcrt.setmode function.  Is this my only path?  Is it valid to
> change the mode of stdout?  The file.newlines is not writable.

What about opening the file in binary mode? This should give you control
over the line endings.

Reinhold

-- 
Wenn eine Linuxdistribution so wenig brauchbare Software wie Windows
mitbrächte, wäre das bedauerlich.  Was bei Windows der Umfang eines
"kompletten Betriebssystems" ist, nennt man bei Linux eine Rescuedisk.
  -- David Kastrup in de.comp.os.unix.linux.misc



More information about the Python-list mailing list