Skip to content

Instantly share code, notes, and snippets.

@alexmitelman
Created November 3, 2018 23:46
Show Gist options
  • Save alexmitelman/32fe265824a7cd01bcb7a4d9baec69eb to your computer and use it in GitHub Desktop.
Save alexmitelman/32fe265824a7cd01bcb7a4d9baec69eb to your computer and use it in GitHub Desktop.
import requests
from lxml import html
url = 'https://en.wikipedia.org/wiki/Most_common_words_in_English'
words = []
r = requests.get(url)
html_source = r.text
tree = html.fromstring(html_source)
rows = tree.xpath('//tr')
for row in rows:
words.append(row[0].text_content())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment