◐ Shell
clean mode source ↗

Python Language Tutorial => Standard error stream

Example

# Error messages should not go to standard output, if possible.
print('ERROR: We have no cheese at all.', file=sys.stderr)

try:
    f = open('nonexistent-file.xyz', 'rb')
except OSError as e:
    print(e, file=sys.stderr)

Got any Python Language Question?

pdf PDF - Download Python Language for free



Previous Next