Created
March 22, 2017 17:07
-
-
Save tym-xqo/e6e99702ef46a1e6ecebc644750a54dd to your computer and use it in GitHub Desktop.
Export data from interactive python shell
This file contains hidden or 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
$ python | |
>>> import sys | |
>>> v = 'some value for this variable' | |
>>> x = open('/path/to/somefile', 'w') | |
>>> sys.stdout = x | |
>>> print(v) | |
>>> x.close() | |
$ cat /path/to/somefile | |
some value for this variable | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment