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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33d8091772af784ab792cc9c81b31295fb35d95ad194fbcf06a38ec5a1ea71c4 |
|
MD5 | 0610c3f7fc0fa3ac49bf367b0cf4f2df |
|
BLAKE2b-256 | 9921db11d7cb392a279893751114df9e6a68df9b42b95a4d84ddd2c15bc81973 |
Close
Hashes for stdout_stderr_capturing-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16a71b80e55bf986e158333785f8d7372f1706ed6f4930dd355bec3352ff584d |
|
MD5 | 4c6b054dc680fdde5222abed7f86247d |
|
BLAKE2b-256 | 95aadaa7d42d9ef8a957081b300c9263592ec5bf1bf7dea8ac468ec8ac476ed6 |