Created
March 8, 2020 09:17
-
-
Save brchiu/4baabaed0444b31cfcbf41f8d8bbac5f to your computer and use it in GitHub Desktop.
simple proof of concept for parsing Fibonacci Number web page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
from lxml import html | |
import requests | |
r = requests.get('http://www.protocol5.com/Fibonacci/60.htm') | |
tree = html.fromstring(r.content.decode('utf8')) | |
li_elms = tree.xpath("//*[contains(@class, 'number-result')]/li") | |
for li in li_elms: | |
print(li.xpath('h4/text()')) | |
print(li.xpath('div/text()')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment