Last active
January 5, 2019 19:23
-
-
Save adrinjalali/eca43556ca1620c72d91d8326ca59587 to your computer and use it in GitHub Desktop.
Run a python script and get the output as if it was run in the python interpreter.
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
# run as: python run_script.py < your_script.py | |
import code | |
import sys | |
icon = code.InteractiveConsole() | |
prompt = '>>>' | |
for line in sys.stdin: | |
line = line.rstrip() | |
print(prompt, line) | |
prompt = ('...' if icon.push(line) else '>>>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment