Skip to content

Instantly share code, notes, and snippets.

@echiesse
Created December 1, 2020 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echiesse/8042dcd8c220b9d06f488f2450b1d8fd to your computer and use it in GitHub Desktop.
Save echiesse/8042dcd8c220b9d06f488f2450b1d8fd to your computer and use it in GitHub Desktop.
import subprocess
if __name__ == '__main__':
commands = b'''
a=5
b=7
c=a+b
print(c)
print("abacate")
'''
p = subprocess.run('python', input=commands, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(p.stdout.decode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment