f-string大括号外如果需要显示大括号,则应输入连续两个大括号 {undefined{ 和 }}:
name = 'Tom' print(f'my name is {name}') # my name is Tom print(f'my name is {{{name}}}') # my name is {Tom}
2023-10-05 20:54:58
f-string大括号外如果需要显示大括号,则应输入连续两个大括号 {undefined{ 和 }}:
name = 'Tom' print(f'my name is {name}') # my name is Tom print(f'my name is {{{name}}}') # my name is {Tom}