Created
June 24, 2012 15:50
-
-
Save emberian/2983768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{11:47} kb1pkl@sherman[~]$ python | |
Python 2.7.3 (default, Jun 15 2012, 18:14:05) | |
[GCC 4.7.0] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> class Foo(object): | |
... def write(self, msg): | |
... pass | |
... | |
>>> sys.stdout = Foo() | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
NameError: name 'sys' is not defined | |
>>> import sys | |
>>> sys.stdout = Foo() | |
>>> sys.stdout.write('hello') | |
>>> import subprocess | |
>>> subprocess.call(['echo', 'hello'], stdout=subprocess.PIPE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment