using d in python code example
Example 1: python format strings
name = "Rick"
age = 42
print(f"My name is {name} and I am {age} years old")
Example 2: String Formatting with the % Operator
>>> name = 'Bob'
>>> 'Hello, %s' % name
"Hello, Bob"
Example 3: %s %d python
name = "Gandalf"
extendedName = "the Grey"
age = 84
IQ = 149.9
print('type(name):', type(name))
print('type(age):', type(age))
print('type(IQ):', type(IQ))
print('%s %s\'s age is %d with incredible IQ of %f ' %(name, extendedName, age, IQ))
print ('{0} {1}\'s age is {2} with incredible IQ of {3} '.format(name, extendedName, age, IQ))
print ('{} {}\'s age is {} with incredible IQ of {} '.format(name, extendedName, age, IQ))
print("Multiplication of %d and %f is %f" %(age, IQ, age*IQ))
sub1 = "python string!"
sub2 = "an arg"
a = "i am a %s" % sub1
b = "i am a {0}".format(sub1)
c = "with %(kwarg)s!" % {'kwarg':sub2}
d = "with {kwarg}!".format(kwarg=sub2)
print(a)
print(b)
print(c)
print(d)