Ok.This is my first question here
So I’m trying to make this program which searches for the phrase “You have an error” in the HTML source code.The problem is when I try
html_data=urllib2.open(site).read()
if html_data.find(string):
print "It's found"
It doesn’t find it..Although when I print html_data it is found in there with no tags whatsoever.
Can anybody help me on this?
str.find()returns the index (or -1 if not found). Thus the following is incorrect:It should be:
Alternatively, if you don’t need to know the position of the match: