From 49c4f2f1e8f2a332508b07bc158d7b398d0d5e98 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Tue, 27 May 2014 08:28:20 -0500 Subject: [PATCH] Actually fix xmltodict usage --- docs/scenarios/xml.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/scenarios/xml.rst b/docs/scenarios/xml.rst index e1f7b70..7484413 100644 --- a/docs/scenarios/xml.rst +++ b/docs/scenarios/xml.rst @@ -57,7 +57,9 @@ can be loaded into a Python dict like this: .. code-block:: python 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: