P
P
pashazz2012-06-24 00:31:16
Python
pashazz, 2012-06-24 00:31:16

[solved] python 3 xml.etree and yandex

when trying to parse export.yandex.ru/weather-ng/forecasts/29642.xml using xml.etree.ElementTree, all tag names are inadequate, i.e. contain the string '{http://weather.yandex.ru/forecast}'

for example

In [186]: parser
Out[186]: <Element '{http://weather.yandex.ru/forecast}forecast' at 0x2f054d0>

In [188]: parser.getchildren()
Out[188]: 
[<Element '{http://weather.yandex.ru/forecast}fact' at 0x2f056d0>,
 <Element '{http://weather.yandex.ru/forecast}informer' at 0x2f05d10>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x2f05e10>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x2f2bcd0>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x2fc1810>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x2fccf90>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x2fde750>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x2fe7ed0>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x305d690>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x306ae10>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x30785d0>,
 <Element '{http://weather.yandex.ru/forecast}day' at 0x3082d50>]



can you get rid of this?
Solution: lost xmlns.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question