Python string equality always returns false
07:40 17 Mar 2014

I've got a problem with my Python code. For some reason a comparison of two strings is always returning 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 indentation is correct. I had to re-format when inserting here)

The problem I think is the if statement, I have tried many variations where both string weren't enclosed by the str(), I have also tried is instead of == but it is False. I have printed both values on the line before just to check and they are infact equal. Am I missing something?

python string comparison equality