I see I can't do:
"%b %b" % (True, False)
in Python. I guessed %b for b(oolean). Is there something like this?
I see I can't do:
"%b %b" % (True, False)
in Python. I guessed %b for b(oolean). Is there something like this?
Use
"%s %s" % (True, False)
if you want True False
because str(True) is 'True' and str(False) is 'False'.
or
"%i %i" % (True, False)
if you want 1 0
because int(True) is 1 and int(False) is 0.
>>> print "%r, %r" % (True, False)
True, False
This is not specific to boolean values - %r calls the __repr__ method on the argument. %s (for str) should also work.