1
我是新來的python,最近我已經遷移到Python 3和 我試圖去習慣format()
函數。如何在Python格式函數中應用「%.02f」?
我試圖做的是print()
溫度我浮點創建 ,就像這樣:
temperature = [23, 24, 25, 26, 27]
print("Today's temperature is %.02f" % (temperature[0]))
而不是使用%.02f
的,我想知道如何 可能被寫入在format()
函數中代替%
而不是 的百分比。
' '... {:. 02F}'' - RTFM! – jonrsharpe
謝謝!這工作! – PrimeHack