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