@pashazz

[solved] python 3 xml.etree и яндекс

при попытке парсинга export.yandex.ru/weather-ng/forecasts/29642.xml с помощью xml.etree.ElementTree все имена тегов неадекватные, т.е. содержат в себе строку '{http://weather.yandex.ru/forecast}'

например

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>]



от этого можно избавиться?
Решение: затер xmlns.
  • Вопрос задан
  • 2958 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы