getchildren在python 3.9中已经被移除,如果项目中使用会显示错误:
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
解决方法如下:
- 修改前的代码:
for data in tb.getchildren():
- 修改后的代码:
for data in list(tb):
getchildren在python 3.9中已经被移除,如果项目中使用会显示错误:
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
解决方法如下:
for data in tb.getchildren():
for data in list(tb):