UGH, DAMNIT


SUBMITTED BY: Guest

DATE: Oct. 17, 2013, 6:04 p.m.

FORMAT: Python

SIZE: 736 Bytes

HITS: 1145

  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 = raw_input("Are you finished? Y/N")
  18. if (finish == "Y"):
  19. done = True;
  20. elif (finish == "N"):
  21. done = False;

comments powered by Disqus