In your XML the team_members element does not have subelements like
cid etc. It has item subelements. Perhaps you meant for tm in
teamtree.iterfind('team_members/item'). If your CSV headers didn't
have different case for some items, you could've just mapped
tm.findtext over them in the for-loop body to extract the values for
writing. Don't reopen the file all the time for append, but move the
XML extraction to the with-block that initially creates the file and
csv-writer. The final csvfile.close() is also redundant.
Ilja Everilä的评论解决了我的问题。在
相关问题 更多 >
编程相关推荐