我认为问题在于:
result = CoordinateRow([])
当我调试它时,我得到一个返回None的错误
错误:
Traceback (most recent call last):
line 60, in <module>
interlaced_rows = get_interlace_rows(splits_file)
line 49, in get_interlace_rows
previous_row = previous_row.interlace(row)
AttributeError: 'NoneType' object has no attribute 'interlace'
取消缩进返回结果后出现新错误(在类CoordinaterRow中):
Traceback (most recent call last):
line 29, in __getattr__
return self[item]
line 25, in __getitem__
return self._dict[item]
KeyError: 'calculate_new_coord'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
line 59, in <module>
get_new_coordinates(interlaced_rows)
line 54, in get_new_coordinates
new_coordinates = current_coordinates.calculate_new_coord()
line 32, in __getattr__
"'{}' object has no attribute '{}'".format(type(self).__name__, item)
AttributeError: 'Coordinate' object has no attribute 'calculate_new_coord'
从坐标pypi页面:
例如:
只需在
get_new_coordinates
函数中更改这一行:致:
但是,在此之后,您的代码会得到一个
AttributeError: 'Coordinate' object has no attribute 'calculate_new_coord'
,因为您使用的calculate_new_coord
方法在Cordinate
类中不存在编辑:更改问题后,显示不需要坐标模块。只需删除,然后使用您自己的坐标类。在课堂上,将此行更改回原来的位置:
这样,我就得到了预期的输出:
但是,如果需要使用坐标模块,只需执行以下操作:
在这种情况下,需要删除或重命名坐标类
相关问题 更多 >
编程相关推荐