String formatting with % please help?


#1

I used this method when your variable is an integer.
it’s somewhat like this:

day = 6
print “03 - %02d - 2019” % (day)

03 - 06 - 2019

but when used different letters in place of d.
THE CODE WAS STILL WORKING FOR MOST OF THE LETTERS LIKE c,x, and many others.
please help out why is it so!!!


#2

https://docs.python.org/2/library/string.html#format-specification-mini-language
https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior