Skip to content

Instantly share code, notes, and snippets.

@tym-xqo
Created March 22, 2017 17:07
Show Gist options
  • Save tym-xqo/e6e99702ef46a1e6ecebc644750a54dd to your computer and use it in GitHub Desktop.
Save tym-xqo/e6e99702ef46a1e6ecebc644750a54dd to your computer and use it in GitHub Desktop.
Export data from interactive python shell
$ 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