osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

$s and %d in python


Cameron Simpson wrote:
> The variable my_height is an int, and for an int both these things are 
> the same.

But note that 'd' and 's' can give different results when
other formatting options are present, e.g.

 >>> "%05d" % 42
'00042'
 >>> "%05s" % 42
'   42'

-- 
Greg