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
--
https://mail.python.org/mailm
On 6/30/2018 7:04 PM, Cameron Simpson wrote:
On 30Jun2018 05:01, Sharan Basappa wrote:
Is there any difference in %d and %s below. I get the same result:
my_name = 'Zed A. Shaw'
my_age = 35 # not a lie
my_height = 74 # inches
print "Let's talk about %s." % my_name
print "He's %d inches tall."
On 30Jun2018 05:01, Sharan Basappa wrote:
Is there any difference in %d and %s below. I get the same result:
my_name = 'Zed A. Shaw'
my_age = 35 # not a lie
my_height = 74 # inches
print "Let's talk about %s." % my_name
print "He's %d inches tall." % my_height
print "He's %s inches tall." % my
Is there any difference in %d and %s below. I get the same result:
my_name = 'Zed A. Shaw'
my_age = 35 # not a lie
my_height = 74 # inches
print "Let's talk about %s." % my_name
print "He's %d inches tall." % my_height
print "He's %s inches tall." % my_height
Let's talk about Zed A. Shaw.
He's 7