from urllib import urlopen
import re
p = re.compile('<h2><a .*?><a .*? href="(.*?)">(.*?)</a>')
text = urlopen('http://python.org/community/jobs').read()
for url, name in p.findall(text):
print '%s (%s)' % (name, url)
from urllib import urlopen import re p = re.compile(‘<h2><a .*?><a .*? href=(.*?)>(.*?)</a>’) text =
Share
Your regex isn’t what you want. Try this instead:
Also, your way of going about this is probably not the best idea. That said, I’m answering the question as asked. 🙂