小编Yoz*_*cks的帖子

如何将字符串参数放入 f 字符串内的函数中?

我有以下 f 字符串:

f"Something{function(parameter)}"
Run Code Online (Sandbox Code Playgroud)

我想对该参数进行硬编码,它是一个字符串:

f"Something{function("foobar")}"
Run Code Online (Sandbox Code Playgroud)

它给了我这个错误:

SyntaxError: f-string: unmatched '('
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

python f-string

5
推荐指数
1
解决办法
3262
查看次数

标签 统计

f-string ×1

python ×1