3 ms·
Though I don't know of an effortless way to disable debug prints, you can easily redirect to a file. import sys print >>sys.stderr, "STDERR is fun." There's n
by req2 17y ago
Though I don't know of an effortless way to disable debug prints, you can easily redirect to a file.
import sys
print >>sys.stderr, "STDERR is fun."
There's not too much that suggests using this instead of logging.
- Jebdm 17y agoIf for some reason you wanted to do this, you could just do import sys def debug(*s, sep=" ", nl="\n"): print >>sys.stderr, sep.join(map(str, s)), nl, pass debug("There was an error on line", 10, ":", nl="") debug(1,2,3,4,5, sep="-") And then comment out the line with "print" to disable it. Of course, by that point you may as well use the logging module.