Hmmm...


SUBMITTED BY: Guest

DATE: Oct. 18, 2013, 6:26 p.m.

FORMAT: Python

SIZE: 825 Bytes

HITS: 1051

  1. import urllib2
  2. import re
  3. def lookfor(string, url):
  4. file = urllib2.urlopen(url)
  5. text = file.readlines()
  6. for line in text:
  7. if re.match("(.*)"+string+"(.*)", line):
  8. print line;
  9. else:
  10. print "Line doesn't contain requested string."
  11. file.close()
  12. done = False
  13. while (done == False):
  14. userstring = input("What string do you want to search for?");
  15. userurl = input("What URL do you want to search for?");
  16. print lookfor(userstring, userurl);
  17. finish = "null"
  18. while (finish != "Y" and finish != "N"):
  19. finish = raw_input("Are you finished? Y/N")
  20. if (finish == "Y"):
  21. done = True;
  22. elif (finish == "N"):
  23. done = False;

comments powered by Disqus