import pandas as pd
# Читаем XML файл
xml = pd.read_xml(path_or_buffer=r'C:\Users\hp\Desktop\data2.xml')
# Сохраняем DataFrame в Excel
xml.to_excel(r'C:\Users\hp\Desktop\arksData.xlsx', index=False)
data2.xml:
<Ads>
<Ad>
<id>18</id>
<brand>Shacman</brand>
<category>4</category>
<name>Shacman X6000</name>
<price>10490000</price>
<year>2023-01-01T00:00:00+03:00</year>
<manufacturer/>
<status>instok</status>
<currency>RUB</currency>
<species>Седельный тягач</species>
<wheels>4x2</wheels>
<hide>1</hide>
<created_at>2023-12-29T19:06:30+03:00</created_at>
<updated_at>2023-12-29T19:06:30+03:00</updated_at>
<photo_url>\\LAPTOP-2554OM7H\Users\hp\Desktop\green\Plato.jpg</photo_url>
<media_url>
<media url="https://www.impulse.su/images/articles/original/000/186/345.jpg"/>
<media url="\\LAPTOP-2554OM7H\Users\hp\Desktop\green\Plato.jpg"/>
</media_url>
</Ad>
<Ad>
<id>34647865-tghfjmfg-4574</id>
<brand>Shacman</brand>
<category>4</category>
<name>Shacman X6000</name>
<price>10490000</price>
<year>2023-01-01T00:00:00+03:00</year>
<manufacturer/>
<status>instok</status>
<currency>RUB</currency>
<species>Седельный тягач</species>
<wheels>4x2</wheels>
<hide>1</hide>
<created_at>2023-12-29T19:06:30+03:00</created_at>
<updated_at>2023-12-29T19:06:30+03:00</updated_at>
<photo_url>\\LAPTOP-2554OM7H\Users\hp\Desktop\green\Plato.jpg</photo_url>
<media_url>
<media url="\\LAPTOP-2554OM7H\Users\hp\Desktop\green\Plato.jpg"/>
<media url="https://www.impulse.su/images/articles/original/000/186/345.jpg"/>
</media_url>
</Ad>
</Ads>
мне нужно чтоб в media_url-колонку эксели попадали:
<media url="\\LAPTOP-2554OM7H\Users\hp\Desktop\green\Plato.jpg"/>
<media url="https://www.impulse.su/images/articles/original/000/186/345.jpg"/>
через пробел (т.е.
\\LAPTOP-2554OM7H\Users\hp\Desktop\green\Plato.jpg
https://www.impulse.su/images/articles/original/00...
)
Сейчас media_url пуста