diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2019-04-06 23:44:02 -0500 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2019-04-06 23:44:02 -0500 |
commit | a2439508ba5c94546db98593cfa676de9b59babe (patch) | |
tree | 80b02178820811c09b4befc9a9b5efb092813466 /examples/scanYahoo.py | |
parent | 832986ffccac943b363da43795c335eafc31b5da (diff) | |
download | pyparsing-git-a2439508ba5c94546db98593cfa676de9b59babe.tar.gz |
Fixed dict structure in makeHTMLTags expressions, and added tag_body attribute to the generated start expression giving easy access to a SkipTo(closeTag) that will parse the tag's body text; some code cleanup and removed duplication among examples
Diffstat (limited to 'examples/scanYahoo.py')
-rw-r--r-- | examples/scanYahoo.py | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/examples/scanYahoo.py b/examples/scanYahoo.py deleted file mode 100644 index 9ecb5e9..0000000 --- a/examples/scanYahoo.py +++ /dev/null @@ -1,14 +0,0 @@ -from pyparsing import makeHTMLTags,SkipTo,htmlComment
-import urllib.request, urllib.parse, urllib.error
-
-serverListPage = urllib.request.urlopen( "https://www.yahoo.com/" )
-htmlText = serverListPage.read()
-serverListPage.close()
-
-aStart,aEnd = makeHTMLTags("A")
-
-link = aStart + SkipTo(aEnd).setResultsName("link") + aEnd
-link.ignore(htmlComment)
-
-for toks,start,end in link.scanString(htmlText):
- print(toks.link, "->", toks.startA.href)
\ No newline at end of file |