I am having trouble displaying the contents of my program:
#! /usr/bin/python import urllib import re url = "http://yahoo.com" pattern = '''<span class="medium item-label".*?>(.*)</span>''' website = urllib.urlopen(url) pageContent = website.read() result = re.findall(pattern, pageContent) for record in result: print record
exit:
Masked teen killed by dad First look in 'Hotel of Doom' Ex-NFL QB's sad condition Reporter ignores warning Romney's low bar for debates
So the question is what should I include in my code to convert & # 39 to characters
source share