Python if statement not working as expected
- by Chris Esposito
I'm searching for a string in a website and checking to see if the location of this string is in the expected location. I know the string starts at the 182nd character, and if I print temp it will even tell me that it is 182, however, the if statement says 182 is not 182.
Some code
f = urllib.urlopen(link)
#store page contents in 's'
s = f.read()
f.close()
temp = s.find('lettersandnumbers')
if (htmlsize == "197"):
#if ((s.find('lettersandnumbers')) == "182"):
if (temp=="182"):
print "Glorious"
doStuff()
else:
print "HTML not correct. Aborting."
else:
print htmlsize
print "File size is incorrect. Aborting."