Burgerlib Python
|
Handy class for capturing stdout from tools and python itself. More...
Public Member Functions | |
def | __init__ (self) |
Declares the internal variables. | |
def | __enter__ (self) |
Invoked on "with" which intercepts all future stdout. | |
def | __exit__ (self, *args) |
Disconnect the stdout and store the items into a list of lines. More... | |
Private Attributes | |
_stdout | |
Saved copy of sys.stdout. | |
_stringio | |
StringIO to redirect output to. | |
Handy class for capturing stdout from tools and python itself.
Examples
with Interceptstdout() as output: do_somethingthatprints()
def burger.Interceptstdout.__exit__ | ( | self, | |
* | args | ||
) |
Disconnect the stdout and store the items into a list of lines.
Using splitlines(), output the buffer into a list of lines into the output field.