Note: Before you go and downvote or close my question, or mark it a duplicate, let me assure you that I have looked a dozens and dozens of similar questions on SO and Googled but after more than an hour, I still haven't solved this problem. No other answer solved my problem.
Question I have this Python code:
text = ''
text += '<' + '/' + '>'
print text, '</>'
print repr(text), repr('</>')
if text is '</>':
print 'Equal'
else:
print 'Not equal!'
I simply want to compare two strings. For some reason, I need to concatenate characters to text
one by one. I expected the if-statement to evaluate to True
but it doesn't. And I am at a loss why!
Here's the output:
</> </>
'</>' '</>'
Not equal!
I am new to Python, and am using Python 2.7. Can anybody help, please?