diff options
author | Leonard Richardson <leonardr@segfault.org> | 2020-06-11 16:10:48 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2020-06-11 16:10:48 -0400 |
commit | 1d242a3e18bae642fce14b3192fee051a7122a1c (patch) | |
tree | 617bc907564322b6a2b243dd4e0684aa0bab3c62 | |
parent | a032f89fd5e354b4bd0144b962fd88b55ab0250d (diff) |
Converted the sample code in README.md to Python 3.
-rw-r--r-- | README.md | 42 | ||||
-rw-r--r-- | doc/source/index.rst | 2 |
2 files changed, 22 insertions, 22 deletions
@@ -7,36 +7,36 @@ idioms for iterating, searching, and modifying the parse tree. ``` >>> from bs4 import BeautifulSoup >>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML") ->>> print soup.prettify() +>>> print(soup.prettify()) <html> -<body> -<p> -Some -<b> -bad -<i> -HTML -</i> -</b> -</p> -</body> + <body> + <p> + Some + <b> + bad + <i> + HTML + </i> + </b> + </p> + </body> </html> >>> soup.find(text="bad") -u'bad' +'bad' >>> soup.i <i>HTML</i> # >>> soup = BeautifulSoup("<tag1>Some<tag2/>bad<tag3>XML", "xml") # ->>> print soup.prettify() -<?xml version="1.0" encoding="utf-8"> +>>> print(soup.prettify()) +<?xml version="1.0" encoding="utf-8"?> <tag1> -Some -<tag2 /> -bad -<tag3> -XML -</tag3> + Some + <tag2/> + bad + <tag3> + XML + </tag3> </tag1> ``` diff --git a/doc/source/index.rst b/doc/source/index.rst index 22892c4..1159195 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -2180,7 +2180,7 @@ You can call ``Tag.smooth()`` to clean up the parse tree by consolidating adjace # A one, a two # </p> -`The ``smooth()`` method is new in Beautiful Soup 4.8.0.` +The ``smooth()`` method is new in Beautiful Soup 4.8.0. Output ====== |