!s
选择用于str
设置对象格式,而!r
选择repr
设置值格式
hi = 'hello'
print(f'{hi!r}') # 'hello'
print(f'{hi!s}') # hello
print(f'{hi}') # hello
!s
选择用于str
设置对象格式,而!r
选择repr
设置值格式
hi = 'hello'
print(f'{hi!r}') # 'hello'
print(f'{hi!s}') # hello
print(f'{hi}') # hello