We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 184ef03 + 6e4eb1f commit a9dad6bCopy full SHA for a9dad6b
docs/scenarios/scrape.rst
@@ -38,7 +38,10 @@ parse it using the ``html`` module and save the results in ``tree``:
38
.. code-block:: python
39
40
page = requests.get('http://econpy.pythonanywhere.com/ex/001.html')
41
- tree = html.fromstring(page.text)
+ tree = html.fromstring(page.content)
42
+
43
+(We need to use ``page.content`` rather than ``page.text`` because
44
+``html.fromstring`` implicitly expects ``bytes`` as input.)
45
46
``tree`` now contains the whole HTML file in a nice tree structure which
47
we can go over two different ways: XPath and CSSSelect. In this example, we
0 commit comments