Portable /dev/null?

Peter Hansen peter at engcorp.com
Wed Jan 28 15:11:56 CET 2004


Josiah Carlson wrote:
> 
> Nicolas Fleury wrote:
> 
> > Hi everyone,
> >     Is there an object in some standard library that would be the
> > portable equivalent of "file('/dev/null','w')" or do I have to create my
> > own class and object to do it?  If it doesn't exist, do you think it
> > would be a good idea to have such an object in a standard library?
> >
> > Thx and Regards,
> >
> > Nicolas
> >
> 
> In Windows you can open the file 'NUL' and it will work the same as
> '/dev/null' in *nix.

Note that Nicolas asked for a "portable" approach...  clearly neither
NUL nor /dev/null are portable.



More information about the Python-list mailing list