/dev/null as a file-like object, or logging to nothing

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Sep 9 15:17:49 EDT 2007


En Sat, 08 Sep 2007 14:42:14 -0300, Torsten Bronger  
<bronger at physik.rwth-aachen.de> escribi�:

>> `os.devnull`?
>
> Yes, but I wasn't really sure how portable it is, in particular, on
> Windows.  So does
>
> open(os.devnull, "w").write("Schallalla")
>
> work on Windows like on Unix?

Yes. os.devnull=='nul' on Windows.

-- 
Gabriel Genellina




More information about the Python-list mailing list