MCPcopy Create free account
hub / github.com/RustPython/RustPython / redirect_stdout

Class redirect_stdout

Lib/contextlib.py:411–424  ·  view source on GitHub ↗

Context manager for temporarily redirecting stdout to another file. # How to send help() to stderr with redirect_stdout(sys.stderr): help(dir) # How to write help() to a file with open('help.txt', 'w') as f: with redirect_stdout(f):

Source from the content-addressed store, hash-verified

409
410
411class redirect_stdout(_RedirectStream):
412 """Context manager for temporarily redirecting stdout to another file.
413
414 # How to send help() to stderr
415 with redirect_stdout(sys.stderr):
416 help(dir)
417
418 # How to write help() to a file
419 with open('help.txt', 'w') as f:
420 with redirect_stdout(f):
421 help(pow)
422 """
423
424 _stream = "stdout"
425
426
427class redirect_stderr(_RedirectStream):

Callers 2

test_file_faultMethod · 0.90
import_moduleFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_file_faultMethod · 0.72