$s and %d in python

Sharan Basappa sharan.basappa at gmail.com
Sat Jun 30 08:01:26 EDT 2018


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 74 inches tall.
He's 74 inches tall.



More information about the Python-list mailing list