In this post, we will see how to resolve I have exported sales data from my ecommerce site to XML. I need help pulling out specific information that is nested within an order using python
Question:I want to start by saying I have no experience working with XML files. I just started poking around this data in the past couple of days and have some code that somewhat works, it just needs a couple tweaks. The code I have is here:
I was expecting there to be multiple lines for orders with more than one item, instead items from order 515 went to the next line with the next OrderID 516.
Here is the XML for 2 orders:
Best Answer:Consider relating your iterations with nested looping which you can achieve with comprehensions:
If you have better answer, please add a comment about this, thank you!