diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2012-11-23 08:54:10 +0000 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2012-11-23 08:54:10 +0000 |
commit | 774e46526945ea91265734a2dc82d15eed515577 (patch) | |
tree | 734ae210c20a98f01fe029f7e6eeb7a93b4617fb /src/examples/htmlStripper.py | |
parent | 6b12041d4656f4cda910f24acda8d71013166fbd (diff) | |
download | pyparsing-git-774e46526945ea91265734a2dc82d15eed515577.tar.gz |
Clean up examples to be Python 3 compatible
Diffstat (limited to 'src/examples/htmlStripper.py')
-rw-r--r-- | src/examples/htmlStripper.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/examples/htmlStripper.py b/src/examples/htmlStripper.py index 502acc5..0b0f459 100644 --- a/src/examples/htmlStripper.py +++ b/src/examples/htmlStripper.py @@ -7,7 +7,7 @@ # Copyright (c) 2006, Paul McGuire
#
from pyparsing import *
-import urllib
+import urllib.request, urllib.parse, urllib.error
removeText = replaceWith("")
scriptOpen,scriptClose = makeHTMLTags("script")
@@ -23,7 +23,7 @@ commonHTMLEntity.setParseAction(replaceHTMLEntity) # get some HTML
targetURL = "http://wiki.python.org/moin/PythonDecoratorLibrary"
-targetPage = urllib.urlopen( targetURL )
+targetPage = urllib.request.urlopen( targetURL )
targetHTML = targetPage.read()
targetPage.close()
@@ -36,4 +36,4 @@ repeatedNewlines = LineEnd() + OneOrMore(LineEnd()) repeatedNewlines.setParseAction(replaceWith("\n\n"))
secondPass = repeatedNewlines.transformString(firstPass)
-print secondPass
\ No newline at end of file +print(secondPass)
\ No newline at end of file |