Friday, March 27, 2015

simple python urllib and parsing website with regular expression

import urllib,urllib2,re

url = 'http://www.dummy.com'


data = urllib.urlopen(url)
webpage = data.read()

para = re.findall(r'Episode(.*?)Episode',str(webpage))

for eachpara in para:
    print("Episode"+eachpara)


No comments:

Post a Comment