Converting from a string to boolean in Python

In Python, you can use the bool() function to convert a string to a boolean. For example:

string = "True"
boolean = bool(string)
print(boolean) # Output: True

Watch a course Python - The Practical Guide

Note that the bool() function in Python returns True when the input string is non-empty and False when the input string is empty.

Regarding the specific string values of "True" and "False", both will be evaluated as True by the bool() function since they are non-empty strings.