I see I can\'t do:
\"%b %b\" % (True, False)
in Python. I guessed %b
for b(oolean). Is there something like this?
You may also use the Formatter class of string
print "{0} {1}".format(True, False);
print "{0:} {1:}".format(True, False);
print "{0:d} {1:d}".format(True, False);
print "{0:f} {1:f}".format(True, False);
print "{0:e} {1:e}".format(True, False);
These are the results
True False
True False
1 0
1.000000 0.000000
1.000000e+00 0.000000e+00
Some of the %
-format type specifiers (%r
, %i
) are not available. For details see the Format Specification Mini-Language