summaryrefslogtreecommitdiff
path: root/doc/tutorial.txt
diff options
context:
space:
mode:
authorSam Manzi <manzi.sam@gmail.com>2016-12-04 08:21:58 +1100
committerGitHub <noreply@github.com>2016-12-04 08:21:58 +1100
commitea2e8bf5dbb92b82916c0a8aed92aed4a1e9aa38 (patch)
tree65251eeb9021947b1fc579e23f93aedc321e2b87 /doc/tutorial.txt
parent12589e1db4704bffcd28191e29b8e827d989d908 (diff)
downloadpython-lxml-ea2e8bf5dbb92b82916c0a8aed92aed4a1e9aa38.tar.gz
Tutorial: Import BytesIO and mark text as bytes
For python 3 fixes: * NameError: name 'BytesIO' is not defined * TypeError: a bytes-like object is required, not 'str'
Diffstat (limited to 'doc/tutorial.txt')
-rw-r--r--doc/tutorial.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/tutorial.txt b/doc/tutorial.txt
index 71f3a5d7..1e8f8401 100644
--- a/doc/tutorial.txt
+++ b/doc/tutorial.txt
@@ -822,7 +822,8 @@ doing this all together and use the string parsing functions above.
.. sourcecode:: pycon
- >>> some_file_like_object = BytesIO("<root>data</root>")
+ >>> from io import BytesIO
+ >>> some_file_like_object = BytesIO(b"<root>data</root>")
>>> tree = etree.parse(some_file_like_object)