Python 属性错误:生成器对象没有属性';X';
我试图实现一个方法(Python3.4),其中传递两个对象。但我收到以下错误。 “AttributeError:生成器对象没有属性“X” 代码如下所示:Python 属性错误:生成器对象没有属性';X';,python,Python,我试图实现一个方法(Python3.4),其中传递两个对象。但我收到以下错误。 “AttributeError:生成器对象没有属性“X” 代码如下所示: def method_name(node1, node2): parsed = [] nextList = asyncio.Queue() iterations = 0 while not ((newNode.X == node2.X) and (newNode.Y ==
def method_name(node1, node2):
parsed = []
nextList = asyncio.Queue()
iterations = 0
while not ((newNode.X == node2.X) and (newNode.Y == node2.Y)):
#code
我无法理解为什么会出现这个错误。在while循环中使用属性之前,我尝试打印属性的值。我能成功地把它打印出来。但是当我尝试在while循环中使用它时,我会遇到一些问题
提前感谢您的帮助。在我们知道
node2
和newNode
arenewNode指向node1之前,我无法理解为什么会出现此错误,我们也是如此。node1和node2是类的两个对象,它们的属性类似于X,Y,…请编辑您的帖子以包含一个。