Run »
#Use "F" to convert a number into a fixed point number, but display inf and nan as INF and NAN: x = float('inf') txt = "The price is {:F} dollars." print(txt.format(x)) #same example, but with a lower case f: txt = "The price is {:f} dollars." print(txt.format(x))
The price is INF dollars.
The price is inf dollars.