Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/scenarios/scrape.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ parse it using the ``html`` module and save the results in ``tree``:
.. code-block:: python

page = requests.get('http://econpy.pythonanywhere.com/ex/001.html')
tree = html.fromstring(page.text)
tree = html.fromstring(page.content)

(We need to use ``page.content`` rather than ``page.text`` because
``html.fromstring`` implicitly expects ``bytes`` as input.)

``tree`` now contains the whole HTML file in a nice tree structure which
we can go over two different ways: XPath and CSSSelect. In this example, we
Expand Down