Show More
@@ -1,18 +1,18 b'' | |||||
1 | import sys |
|
1 | import sys | |
2 |
|
2 | |||
3 | globalvars = {} |
|
3 | globalvars = {} | |
4 | lines = sys.stdin.readlines() |
|
4 | lines = sys.stdin.readlines() | |
5 | while lines: |
|
5 | while lines: | |
6 | l = lines.pop(0) |
|
6 | l = lines.pop(0) | |
7 | if l.startswith('SALT'): |
|
7 | if l.startswith('SALT'): | |
8 |
print |
|
8 | print(l[:-1]) | |
9 | elif l.startswith('>>> '): |
|
9 | elif l.startswith('>>> '): | |
10 | snippet = l[4:] |
|
10 | snippet = l[4:] | |
11 | while lines and lines[0].startswith('... '): |
|
11 | while lines and lines[0].startswith('... '): | |
12 | l = lines.pop(0) |
|
12 | l = lines.pop(0) | |
13 | snippet += l[4:] |
|
13 | snippet += l[4:] | |
14 | c = compile(snippet, '<heredoc>', 'single') |
|
14 | c = compile(snippet, '<heredoc>', 'single') | |
15 | try: |
|
15 | try: | |
16 |
exec |
|
16 | exec(c, globalvars) | |
17 |
except Exception |
|
17 | except Exception as inst: | |
18 |
print |
|
18 | print(repr(inst)) |
General Comments 0
You need to be logged in to leave comments.
Login now