View Single Post
Old 10-12-2010, 05:58 AM   #4
m.tarenskeen
Member
m.tarenskeen began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Oct 2010
Device: BeBook One
[QUOTE=TonytheBookworm;1156268]
try:
response = br.follow_link(url_regex='.*?(2010)(\\/)(article)(\\/)(print)(\\/)', nr = 0)
html = response.read()
except:
response = br.open(url)
html = response.read()

Looks like this will only work in 2010 and will be outdated after 3 months already ?
What about something like

try:
for yy in range(2010,2020):
response = br.follow_link(url_regex='.*?(%d)(\\/)(article(\\/)(print)(\\/)', nr = 0) % yy

(BTW: How do I keep my indentation intact in this online message editor ? If I "preview Post" it disappears. Not exactly what I want when posting Python code.)
m.tarenskeen is offline   Reply With Quote