S
S
Sergey2017-02-23 16:27:58
Python
Sergey, 2017-02-23 16:27:58

How to get a dictionary from lists?

Hello!
Please help, I can't figure it out. I'm trying to parse xml like this:

<a>
  <b>BBB</b>
  <c>CCC</C>
  <d>
    <e>EEE</e>
  </d>
</a>

I get a list of lists as output:

How to get a dictionary of the form from it:
{'a':[{'b':'BBB'}, {'c':'CCC'}, {'d':{'e':'EEE'}}]}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-04-24
@Survtur

Use well-established XML parsers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question