The Python Oracle

Python string comparison

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Track title: CC F Haydns String Quartet No 53 in D

--

Chapters
00:00 Python String Comparison
01:11 Accepted Answer Score 8
01:32 Answer 2 Score 6
01:44 Thank you

--

Full question
https://stackoverflow.com/questions/2516...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #string #compare

#avk47



ACCEPTED ANSWER

Score 8


Are you sure that there isn't a terminating line feed character, making your string contain "true\n"? That seems likely.

You could try return isdeployed.startswith("true"), or some stripping.




ANSWER 2

Score 6


Have you tried to call

isdeployed.strip()

before the comparision