I'm trying to write items from a list to several files. I would like to name each file according to its date. Please bear in mind I know I shouldn't use regular expressions to scrape HTML but for the time being it serves me well. Excuse the ignorance but I'm a beginner. This scraping is only for academic purposes. Thank you in advance.
from urllib import urlopen
import re
webpage = urlopen('x').read()
date = re.compile('[0-9]{2}-[a-zA-Z]{3}-[0-9]{4}')
article = re.compile('<span>.*<div>', re.DOTALL)
findDate = re.findall(patFinderDate,webpage)
findArticle = re.findall(patFinderArticle,webpage)
listIterator = []
listIterator[:] = range(0,1000)
for i in listIterator:
filename = findDate[i]
with open(filename,"w") as f:
f.write(i)
f.close()