diff options
Diffstat (limited to 'Demo/xml/elem_count.py')
-rw-r--r-- | Demo/xml/elem_count.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Demo/xml/elem_count.py b/Demo/xml/elem_count.py index 7b53189c7c4..a2b4647548d 100644 --- a/Demo/xml/elem_count.py +++ b/Demo/xml/elem_count.py @@ -15,20 +15,20 @@ class FancyCounter(handler.ContentHandler): self._attrs = self._attrs + len(attrs) self._elem_types[name] = self._elem_types.get(name, 0) + 1 - for name in attrs.keys(): + for name in list(attrs.keys()): self._attr_types[name] = self._attr_types.get(name, 0) + 1 def endDocument(self): - print "There were", self._elems, "elements." - print "There were", self._attrs, "attributes." + print("There were", self._elems, "elements.") + print("There were", self._attrs, "attributes.") - print "---ELEMENT TYPES" - for pair in self._elem_types.items(): - print "%20s %d" % pair + print("---ELEMENT TYPES") + for pair in list(self._elem_types.items()): + print("%20s %d" % pair) - print "---ATTRIBUTE TYPES" - for pair in self._attr_types.items(): - print "%20s %d" % pair + print("---ATTRIBUTE TYPES") + for pair in list(self._attr_types.items()): + print("%20s %d" % pair) parser = make_parser() |