from simplified_scrapy import SimplifiedDoc, utils
#simplified_scrapy is framework for extrcting data
xml = utils.getFileContent('check_in.xml')
doc = SimplifiedDoc(xml)
#SimplifiedDoc is a library for parsing data such as HTML and XML
nodes = doc.select('air:EDS_AirCheckInRQ').children
print (nodes.tag)
for x in nodes:
print((doc.select('air:EDS_AirCheckInRQ')['Version']),(doc.select('com:Source')))
Here is my output:-
4.000 {'tag': 'com:Source', 'AirlineVendorID': 'CM'}
4.000 {'tag': 'com:Source', 'AirlineVendorID': 'CM'}
4.000 {'tag': 'com:Source', 'AirlineVendorID': 'CM'}
4.000 {'tag': 'com:Source', 'AirlineVendorID': 'CM'}
4.000 {'tag': 'com:Source', 'AirlineVendorID': 'CM'}
4.000 {'tag': 'com:Source', 'AirlineVendorID': 'CM'}
这是我的 python 代码,我只想在其中打印一次,但是当我运行它时,它会给出打印多次的输出。我只想打印一次。谁能帮我解决为什么打印多次而不是一次?
慕姐8265434
江户川乱折腾
相关分类