summaryrefslogtreecommitdiffstats
path: root/Demo/xml/roundtrip.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-10-11 15:56:06 (GMT)
committerGeorg Brandl <georg@python.org>2009-10-11 15:56:06 (GMT)
commitbc470d5023226dc1af3daa1c1bb5c221d9bba939 (patch)
tree88fcbc03329e9965c45bed9fc6d266ad02aca43e /Demo/xml/roundtrip.py
parent97b0837587671ce60b4fdea6a4c63bb55c219329 (diff)
downloadcpython-bc470d5023226dc1af3daa1c1bb5c221d9bba939.zip
cpython-bc470d5023226dc1af3daa1c1bb5c221d9bba939.tar.gz
cpython-bc470d5023226dc1af3daa1c1bb5c221d9bba939.tar.bz2
Merged revisions 75358 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75358 | georg.brandl | 2009-10-11 17:06:44 +0200 (So, 11 Okt 2009) | 1 line Overhaul of Demo/xml. ........
Diffstat (limited to 'Demo/xml/roundtrip.py')
-rw-r--r--Demo/xml/roundtrip.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Demo/xml/roundtrip.py b/Demo/xml/roundtrip.py
index 8d7d437..801c009 100644
--- a/Demo/xml/roundtrip.py
+++ b/Demo/xml/roundtrip.py
@@ -3,7 +3,7 @@ A simple demo that reads in an XML document and spits out an equivalent,
but not necessarily identical, document.
"""
-import sys, string
+import sys
from xml.sax import saxutils, handler, make_parser
@@ -11,7 +11,7 @@ from xml.sax import saxutils, handler, make_parser
class ContentGenerator(handler.ContentHandler):
- def __init__(self, out = sys.stdout):
+ def __init__(self, out=sys.stdout):
handler.ContentHandler.__init__(self)
self._out = out
@@ -40,6 +40,7 @@ class ContentGenerator(handler.ContentHandler):
# --- The main program
-parser = make_parser()
-parser.setContentHandler(ContentGenerator())
-parser.parse(sys.argv[1])
+if __name__ == '__main__':
+ parser = make_parser()
+ parser.setContentHandler(ContentGenerator())
+ parser.parse(sys.argv[1])