[英]Traceback (most recent call last): File “newdata.py”, line 51, in <module> temp_res.update(i['statistics']) KeyError: 'statistics'
[英]I'm getting this error : Traceback (most recent call last): File "./prog.py", line 4, in <module> KeyError: 'price'
prices = ['31', '32']
txt = "For only {price:.2f} dollars!"
for i in prices:
print(txt.format(prices))
我正在嘗試這樣做: 只需 31.00 美元 只需 32.00 美元,但我正面臨這個問題。 請幫忙,我是菜鳥
prices = ['31', '32']
txt = "For only {price:.2f} dollars!"
for i in prices:
print(txt.format(prices))
你在那里大約有 80%。
試試下面的代碼:
prices = ['31', '32']
for i in prices:
print(f"For only {int(i):.2f} dollars!")
For only 31.00 dollars!
For only 32.00 dollars!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.