demo_string_placeholder16.py:
#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))
C:\Users\My Name>python demo_string_placeholder16.py
The price is INF dollars.
The price is inf dollars.