Serhiy Storchaka added the comment:
If you need true file object, with name, fileno() etc, you can use
open(os.devnull, 'w'). If the simple file-like object is enough, it is just few
lines:
class NullWriter:
def write(self, s): pass
io.StringIO() works in most cases well too.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28864>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com