Skip to content

Instantly share code, notes, and snippets.

@Gunio
Created October 18, 2011 18:33

Revisions

  1. Gunio revised this gist Oct 18, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Parsing HTML in Python
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    import requests
    import lxml
    from lxml import html

    r = requests.get('http://gun.io')
    tree = lxml.html.fromstring(r.content)
  2. Gunio created this gist Oct 18, 2011.
    8 changes: 8 additions & 0 deletions Parsing HTML in Python
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    import requests
    import lxml

    r = requests.get('http://gun.io')
    tree = lxml.html.fromstring(r.content)
    elements = tree.get_element_by_id('frontsubtext')
    for el in elements:
    print el.text_content()