From ea2e8bf5dbb92b82916c0a8aed92aed4a1e9aa38 Mon Sep 17 00:00:00 2001 From: Sam Manzi Date: Sun, 4 Dec 2016 08:21:58 +1100 Subject: 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' --- doc/tutorial.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/tutorial.txt') 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("data") + >>> from io import BytesIO + >>> some_file_like_object = BytesIO(b"data") >>> tree = etree.parse(some_file_like_object) -- cgit v1.2.1