python 文字列操作

trim

strip()

文字列をbool値に変換

Converting from a string to boolean in Python? - Stack Overflow

formencodeを使う
http://formencode.org/modules/validators.html

>>> from formencode.validators import StringBool
>>> StringBool.to_python('True')
True
>> StringBool.to_python('False')
False
>>> StringBool.to_python('t')
True
>>> StringBool.to_python('f')
False
>>> StringBool.to_python('')
>>> bool(StringBool.to_python(''))
False