我正在尝试用简单的语言编译。我正在使用pypy,但是 出于某种原因,我无法访问全局变量。
Traceback (most recent call last):
File "app_main.py", line 72, in run_toplevel
File "c.py", line 80, in <module>
sys.stdout.write(main(sys.stdin) + '\n')
File "c.py", line 75, in main
process()
File "c.py", line 58, in process
l(n)
File "c.py", line 9, in l
ot += [tline[0], '('] + tline[1:-1] + [') {']
UnboundLocalError: local variable 'ot' referenced before assignment
这里的问题是ot
是一个全局变量
我之前已经放过global ot
提前谢谢。