【发布时间】:2014-11-22 14:56:58
【问题描述】:
我的代码产生以下错误:TypeError: object() takes no parameters
class Graph(object):
def vertices(self):
return list(self.__graph_dict.keys())
if __name__ == "__main__":
g = { "a" : ["d"],
"b" : ["c"],
"c" : ["b", "c", "d", "e"],
"d" : ["a", "c"],
"e" : ["c"],
"f" : []
}
graph = Graph(g)
print("Vertices of graph:")
print(graph.vertices())
有什么办法可以解决这个问题吗?
【问题讨论】:
标签: python object parameters