diff options
| author | Sam Manzi <manzi.sam@gmail.com> | 2016-12-04 08:21:58 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-12-04 08:21:58 +1100 |
| commit | ea2e8bf5dbb92b82916c0a8aed92aed4a1e9aa38 (patch) | |
| tree | 65251eeb9021947b1fc579e23f93aedc321e2b87 /doc/tutorial.txt | |
| parent | 12589e1db4704bffcd28191e29b8e827d989d908 (diff) | |
| download | python-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.txt | 3 |
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) |
