![](/img/trans.png)
[英]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.