I'm trying to search a html site for a spefic word and print the result thats x rows after that word.
If the html page looks like:
"Hello welcome to daniweb"
I want to search for welcome and look for what the next word is ("to" should be the result).
I know how to get the whole line where the searchword is located as seen below. But thats it, dont have a clue how to do what i want.
import urllib sock = urllib.urlopen("http://blabla.com") htmls = sock.read() sock.close() keyword = re.compile(r,"welcome") for line in text: print line,