I have a string
pulled from an excel spreadsheet, call it x
. When using the print
statement it prints the word PLANT
print(x)
PLANT
When I do the following:
if x == 'PLANT':
print('YES')
else:
print('NO')
It always prints NO.
I believe this is caused by the ==
checking something more fundamental than just the surface string. I tried to investigate further by using the ascii command, but this does not show any difference either.
ascii(x)
Are there any other commands I could try to distinguish x
from PLANT
and understand why they are not matching?
Things tested
repr(x)
'PLANT'
type(x)
<class 'str'>
ascii(x)
'PLANT'
Difference found:
id(x)
30805824
id('PLANT')
28515008