最后一行,请问这里的格式化用f是什么意思,这个print(f"x:{x})又是指什么


用大括号 {} 表示被替换字段,其中直接填入替换内容:
参考链接:https://blog.csdn.net/lizhaoyi123/article/details/102731501
>>> name = 'Eric'
>>> f'Hello, my name is {name}'
'Hello, my name is Eric'
>>> number = 7
>>> f'My lucky number is {number}'
'My lucky number is 7'
>>> price = 19.99
>>> f'The price of this book is {price}'
'The price of this book is 19.99'
这里的print(f"x:{x})中,简单的说就是等效于 将变量x的值自动转换为str类型后将{x}替换,即:print(f"x:{x}) = print( "x:"+str(x) )