Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is str(Bool) locale dependent

Tags:

python

locale

When in a python script I write

>>> v = True
>>> str(v).upper()
'TRUE'

can I assume that 'TRUE' will always be the result, or can I have a translation of True in user terminal language (e.g 'WAHR' if user terminal is in German)?


1 Answers

It will always be TRUE, but if you want to hardcode it yourself:

print( 'TRUE' if v else 'FALSE' )
like image 120
tituszban Avatar answered Feb 09 '26 09:02

tituszban



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!