Capture the stdout or stderr output as a list in a context manager block (with).
Project description
Capture the stdout or stderr output as a list in a context manager block (with).
Maybe better alternatives:
Capture stdout:
with Capturing() as output:
print('line 1')
print(output[0])
is equivalent to
with Capturing(stream='stdout') as output:
print('line 1')
Capture stderr:
with Capturing(stream='stderr') as output:
print('line 1', file=sys.stderr)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for stdout_stderr_capturing-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3af33b8136b90f70bf13129ae5a565c7d6da4a18704e7e1c0d9284af17620f92 |
|
MD5 | 32d9beb96733c043c091d8132b7c1885 |
|
BLAKE2b-256 | 750d41d840284ecad907e8779fc052f366ae3fd8a192df243591482ccebd3fcd |
Close
Hashes for stdout_stderr_capturing-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a730cf85703e97a8945b2726fbb8a6aa91bb82c9c14c35612bf8ff89ac6c1fe8 |
|
MD5 | 871305eebd2acc4b03f4ec93347ade13 |
|
BLAKE2b-256 | 93588efa822d24e588bde49ab7ad994774cf688f51b30e747c539c842ee4db95 |