Is there a way to convert true of type unicode to 1 and false of type unicode to 0 (in Python)?
true
unicode
false
For example: x
x
bool to int: x = (x == 'true') + 0
x = (x == 'true') + 0
Now the x contains 1 if x == 'true' else 0.
x == 'true'
Note: x == 'true' will return bool which then will be typecasted to int having value (1 if bool value is True else 0) when added with 0.