Skip to content

Commit 2d7541b

Browse files
authored
Update tpy.py
1 parent 59f7fac commit 2d7541b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

true/tpy.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import sys
2-
try: code = open(sys.argv[1]).read()
2+
try:
3+
code = open(sys.argv[1]).read()
4+
try: i = open(sys.argv[2]).readlines()
5+
except: i=[]
36
except: print(f"Usage: python {__file__.split(chr(0x5c))[-1]} \"(file name)\"");exit()
47
p = 0; ts = []; s = []
58
if not code : code = " "
69
while 1:
710
if code[p] == '"' :
8-
p+=1;s.append(code[p : code.index('"', p)])
11+
p+=1; s.append(code[p : code.index('"', p)])
912
p=code.index('"', p)
1013
elif code[p] == "." : print(s.pop())
11-
elif code[p] == "," : s.append(input())
14+
elif code[p] == "," :
15+
if i : s.append(i.pop())
16+
else : raise EOFError("Input reached an EOF")
1217
elif code[p] in "0123456789" : s.append(int(code[p]))
1318
elif code[p] == "[" : p=code.index("]", p)
1419
elif code[p] == "+" : s.append(int(s.pop())+int(s.pop()))

0 commit comments

Comments
 (0)