I was trying to print a truth table for Boolean expressions. While doing this, I stumbled upon the following:
>>> format(True, "") # shows True in a string representation, same as str(True)
'True'
>>> format(True, "^") # centers True in the middle of the output string
'1'
As soon as I specify a format specifier, format() converts True to 1. I know that bool is a subclass of int, so that True evaluates to 1:
>>> format(True, "d") # shows True in a decimal format
'1'
But why does using the format specifier change 'True' to 1 in the first example?
I turned to the docs for clarification. The only thing it says is:
A general convention is that an empty format string ("") produces the same result as if you had called str() on the valu