Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 32 lines (27 sloc) 708 Bytes
#!/usr/bin/env python
import sys, os, re
from functools import partial
from itertools import *
code_part = partial(compile, sys.argv[1], __file__)
try:
mode = 'eval'
code = code_part(mode)
except SyntaxError:
mode = 'exec'
code = code_part(mode)
run = lambda cmd, input: os.system(cmd.replace('%s', input))
a = b = c = None
i = 1
lines = iter(sys.stdin)
try:
for line in lines:
l = line = line[:-1]
w = words = l.split()
out = eval(code, globals(), locals())
if mode == 'eval' and out:
if type(out) in (list, tuple):
for o in out: print o
else: print out
i += 1
except KeyboardInterrupt:
sys.exit(1)
Jump to Line
Something went wrong with that request. Please try again.