How to convert a string to boolean in Python
In this tutorial, we are going to learn about how to convert the string to a boolean in Python.
Converting string to boolean
To convert a string to boolean, we can use the double equals operator ==
in Python.
Here is an example, that converts the msg
string to Boolean value:
msg = "Hello"
convertB = (msg == "True")
print(convertB)
Output:
False