Skip to content

Instantly share code, notes, and snippets.

@moriya9n
Last active May 5, 2018 03:54
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 moriya9n/54d47757e75eaaafc5af2c48513d6aca to your computer and use it in GitHub Desktop.
Save moriya9n/54d47757e75eaaafc5af2c48513d6aca to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import requests
import csv
# list
r = requests.get('https://www.mizuhobank.co.jp/retail/takarakuji/loto/loto6/csv/loto6.csv')
r.encoding='cp932'
loto6_list = [i[1:5] for i in r.text.splitlines() if i.startswith('第')]
# latest
r = requests.get('https://www.mizuhobank.co.jp/retail/takarakuji/loto/loto6/csv/A102%s.CSV' % loto6_list[0])
r.encoding='cp932'
loto6_result = r.text.splitlines()
reader = csv.reader(loto6_result)
for l in reader:
print(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment