我在使用模块中的类时遇到问题。你知道吗
模块:http://pastebin.com/A3UQ2Ppy
def ClassName(object)
def __init__(self, var):
self.var = var
def method(self):
print 'big success'
脚本:http://pastebin.com/BqVthvG0
import module
object = module.ClassName(1337)
print object.method()
这基本上就是我在代码中所做的,我得到了一个错误: AttributeError:'NoneType'对象没有属性'method'
您没有定义类,而是定义了一个函数:
让它成为一门课:
下一个例外是,您不能分配给集合:
你可能想
self.nodes
成为一本字典:相关问题 更多 >
编程相关推荐