gpt4 book ai didi

python - 如何将 {} 显示为 python f 字符串的一部分

转载 作者:行者123 更新时间:2023-12-05 09:04:45 25 4
gpt4 key购买 nike

<分区>

有什么方法可以将 {} 显示为 f 字符串的一部分,因为它在 f 字符串中具有特殊含义。换句话说:

如果运行 print(f"hello world {}") ,我想要一个类似 hello world {} 的结果

我尝试的解决方案是:print(f"hello world\{\}")。但它没有用。

非常感谢您的帮助

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com