相关疑难解决方法(0)

大括号里面的f-string公式不起作用

我在使用Python 3.7.

我在第3行的代码工作正常,但是当我将基础公式插入第4行时,我的代码返回错误:

SyntaxError:f-string:mismatched'(','{'或'[' (错误指向第一个'('第4行'.

我的代码是:

cheapest_plan_point = 3122.54
phrase = format(round(cheapest_plan_point), ",")
print(f"1: {phrase}")
print(f"2: {format(round(cheapest_plan_point), ",")}")
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚第4行有什么问题.

python f-string

2
推荐指数
1
解决办法
606
查看次数

标签 统计

f-string ×1

python ×1