Re: $s and %d in python

2018-06-30 Thread Gregory Ewing
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 --

Re: $s and %d in python

2018-06-30 Thread Terry Reedy
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

Re: $s and %d in python

2018-06-30 Thread Cameron Simpson
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." %