OK I was looking into number formatting and I found that you could use %d or %i to format an integer. For example:
number = 8
print "your number is %i." % number
or
number = 8
print "your number is %d." % number
But what is the difference? I mean i found something but it was total jibberish. Anyone speak Mild-Code or English here?
解决方案
Python copied the C formatting instructions.
For output, %i and %d are the exact same thing, both in Python and in C.
The difference lies in what these do when you use them to parse input, in C by using the scanf() function. See Difference between format specifiers %i and %d in printf.
Python doesn't have a scanf equivalent, but the Python string formatting operations retained the two options to remain compatible with C.
The new str.format() and format() format specification mini-language dropped support for i and stuck with d only.