我在 python 中创建了一个类,当我尝试将它调用到另一个 python 文件中时(在导入它之后)它不会将它识别为一个类而是一个对象,然后它告诉我我的类不可调用
这是我的课:
class Cell:
def __init__(self,value=9,isVissible=False):
self.value=value
self.isVisible=isVissible
def setValue(self,value):
self.value=value
def setVisible(self):
self.visible=True
这是我试图称呼它的地方:
import Cell,random
class Board:
def __init__(self):
self.board = []
for i in range(12):
a = []
for j in range(12):
x = Cell() <=== right here it's an error
.
.
.(the rest of my program)
最后这里是错误:
x=Cell()
TypeError: 'module' object is not callable
谁能帮我解决这个问题,即使我的老师也不明白我的错误
回首忆惘然
摇曳的蔷薇
相关分类