summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2020-06-11 16:10:48 -0400
committerLeonard Richardson <leonardr@segfault.org>2020-06-11 16:10:48 -0400
commit1d242a3e18bae642fce14b3192fee051a7122a1c (patch)
tree617bc907564322b6a2b243dd4e0684aa0bab3c62 /README.md
parenta032f89fd5e354b4bd0144b962fd88b55ab0250d (diff)
Converted the sample code in README.md to Python 3.
Diffstat (limited to 'README.md')
-rw-r--r--README.md42
1 files changed, 21 insertions, 21 deletions
diff --git a/README.md b/README.md
index 42d7d11..92dd339 100644
--- a/README.md
+++ b/README.md
@@ -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>
```