Skip to content

Commit 49c4f2f

Browse files
committed
Actually fix xmltodict usage
1 parent 1b867b9 commit 49c4f2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/scenarios/xml.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ can be loaded into a Python dict like this:
5757
.. code-block:: python
5858
5959
import xmltodict
60-
obj = xmltodict.parse(open('path/to/file.xml'))
60+
61+
with open('path/to/file.xml') as fd:
62+
obj = xmltodict.parse(fd.read())
6163
6264
and then you can access elements, attributes and values like this:
6365

0 commit comments

Comments
 (0)