为什么我在Python IDLE中没有得到列表未定义的错误? [关闭]

问题描述 投票:-1回答:1

enter image description here

我创建了tictactoe类的对象,然后在其上调用显示方法:我收到错误消息,提示未定义List_1Blockquote

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    a.display()
  File "C:/Users/Kunall/Documents/#1 Code/#Projects/tic_tac_toe_0.2.py", line 6, in display
for l in list_1:
NameError: name 'list_1' is not defined

Blockquote

python list nameerror
1个回答
1
投票
而不是list_1,您应该使用self.list_1,同样使用self.uc_list
© www.soinside.com 2019 - 2024. All rights reserved.