I have a problem with my Python code. For some reason, comparing two strings always returns False.
def checkChanged(checkURL, currentMessage):
tempMessage = urllib.urlopen(checkURL)
tempMessage = tempMessage.read()
print (tempMessage + ". " + currentMessage + ".")
if (str(tempMessage) == str(currentMessage)):
print ("equal")
return False
else:
print ("not equal")
return True
( Assume the indentation is correct. I had to reformat when pasting here )
The problem that I think of is the instruction if, I tried many options where both lines were not enclosed in str(), I also tried isinstead ==, but that False, I printed both values ββon the line before just checking, and they are equal. Did I miss something?
source
share