Skip to content

Instantly share code, notes, and snippets.

@chadmiller
Created February 3, 2016 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadmiller/610c16f1881fade10c14 to your computer and use it in GitHub Desktop.
Save chadmiller/610c16f1881fade10c14 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import re
import urllib.request as ur
history = dict()
request = ur.urlopen("http://www.flalottery.com/exptkt/l6.htm")
page_bytes = request.read()
page_characters = page_bytes.decode(request.headers.get_content_charset() or "UTF-8")
lines = page_characters.split("\n")
current_day = None
for line in lines:
if "Page" in line:
continue # ignore a page number note
# match a date, then prepare a new container for numbers
match = re.search(">(\d+/\d+/\d+)<", line)
if match:
current_day = match.group(1)
history[current_day] = set()
match = re.search(">(\d+)<", line)
if match:
history[current_day].add(int(match.group(1)))
print(history)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment