在上一篇 Python写xml文件 已经将所有订单写入xml文件,这一篇我们把xml文件中的内容读出来,写入excel文件。

  输入xml格式:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <orderlist>
 3     <order>
 4         <customer>姓名1</customer>
 5         <phone>123456</phone>
 6         <address>成都</address>
 7         <count>2</count>
 8     </order>
 9     <order>
10         <customer>姓名2</customer>
11         <phone>234567</phone>
12         <address>成都</address>
13         <count>5</count>
14     </order>
15     <order>
16         <customer>姓名3</customer>
17         <phone>345678</phone>
18         <address>成都</address>
19         <count>1</count>
20     </order>
21 </orderlist>
View Code

相关文章: