mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Actually fix xmltodict usage
This commit is contained in:
@@ -57,7 +57,9 @@ can be loaded into a Python dict like this:
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import xmltodict
|
import xmltodict
|
||||||
obj = xmltodict.parse(open('path/to/file.xml'))
|
|
||||||
|
with open('path/to/file.xml') as fd:
|
||||||
|
obj = xmltodict.parse(fd.read())
|
||||||
|
|
||||||
and then you can access elements, attributes and values like this:
|
and then you can access elements, attributes and values like this:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user