Skip to content

Instantly share code, notes, and snippets.

@skibum55
Created October 14, 2016 04:34
Show Gist options
  • Save skibum55/9885f5caea74695d7b3c17c4e0c4808b to your computer and use it in GitHub Desktop.
Save skibum55/9885f5caea74695d7b3c17c4e0c4808b to your computer and use it in GitHub Desktop.
import urllib2
from bs4 import BeautifulSoup
url = "https://cs109alabs.github.io/lab_files/"
page = urllib2.urlopen(url).read()
soup = BeautifulSoup(page)
with open('output.txt', 'w') as f:
for tr in soup.find_all('tr')[1:]:
tds = tr.find_all('td')
f.write("Time: %s, X-Coord: %s,Y-Coord: %s,Z-Coord: %s\n" % \
(tds[0].text, tds[1].text, tds[2].text,tds[3].text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment