Does anyone know how to do convert from a string to a boolean in Python? 有谁知道如何在Python中从字符串转换为布尔值? I found this link . 我找到了此连接 。 But it doesn't look like a proper way to do it. 但这彷佛不是正确的方法。 Ie using built-in functionality, etc. 即便用内置功能等 python
The reason I'm asking this is because I learned about int("string")
from here. 我之因此这样问,是由于我从这里了解了int("string")
。 But when trying bool("string")
it always returns True
: 可是当尝试bool("string")
它老是返回True
: wordpress
>>> bool("False") True