f-string怎么格式转化
1、animal = "dog"print(f"There is a {animal}.")基本的格式就是f后面街上字符串,然后用大括号括如变量。

3、lucky = 88print(f"The lucky number is {lucky + 12}.")实际上只要语法不出错,这个大括号里面是可以进行运算的。

5、print(f"The lucky number is {{666}}.")如果需要输出大括号,那么我们需要再加一个大括号。

1、animal = "dog"print(f"There is a {animal}.")基本的格式就是f后面街上字符串,然后用大括号括如变量。
3、lucky = 88print(f"The lucky number is {lucky + 12}.")实际上只要语法不出错,这个大括号里面是可以进行运算的。
5、print(f"The lucky number is {{666}}.")如果需要输出大括号,那么我们需要再加一个大括号。