xml文档:
<GetMatchingProductResult ASIN="B071LF9R6G" status="Success">...</GetMatchingProductResult>
<GetMatchingProductResult ASIN="B0714BP3H4" status="Success">...</GetMatchingProductResult>
<GetMatchingProductResult ASIN="B0756FL8R7" status="Success">...</GetMatchingProductResult>
<ResponseMetadata> # 使用minidom解析器打开XML文档
DOMTree = xml.dom.minidom.parse("./test.xml")
collection = DOMTree.documentElement # collection是针对整个文件的文档,GetMatchingProductResults 获取的是三个名字相同的标签,不同标签的数据对象
GetMatchingProductResults = collection.getElementsByTagName('GetMatchingProductResult') # GetMatching 是针对每个标签对象GetMatching作为xml对象进行对应取值
for GetMatching in GetMatchingProductResults:
asin = GetMatching.getElementsByTagName('ASIN')[0].childNodes[0].data
print(asin)

最新文章

  1. Less使用心得
  2. fastcgi与cgi的区别
  3. JS组件系列——两种bootstrap multiselect组件大比拼
  4. Robot Motion(imitate)
  5. MVC 直接把数据库的数据输出到view(太神奇了)
  6. 金蝶K3 破解版
  7. Ubuntu下Java环境配置
  8. careercup-链表 2.1
  9. 2014年百度之星程序设计大赛 - 资格赛 第二题 Disk Schedule
  10. jstat undocumented
  11. cctype学习
  12. Linux使用ssh公钥实现免批量分发管理服务器
  13. mysql 正则表达式问号
  14. E - 改革春风吹满地
  15. A1107. Social Clusters
  16. Linux学习之RPM包管理-rpm命令管理(十六)
  17. 向excel中循环插入值
  18. TCP/IP 笔记 - ICMPv4和ICMPv6 : Internet控制报文协议
  19. 走进java
  20. java开发_&quot;&quot;和null的区别

热门文章

  1. 使用模块定义AngularJS组件
  2. PHP导入导出Excel方法小结
  3. [C#] 如何把void*转换为byte[]
  4. python编程设计模式之接口类和抽象类
  5. Chrome 里的请求报错 &quot; Provisional headers are shown&quot;
  6. 基于Springboot+Junit+Mockito做单元测试
  7. 头条面试题-创建一个Event类,并创建on、off、trigger、once方法
  8. Linux 内核块 urb
  9. react-native-swiper使用时候的小坑
  10. iptables总结,开启端口,查看端口占用情况