python新增语法f-string

x=12
y=15
print(f'{x+y}')  #python3.6
#27
print(f'{x+y=}')  #python3.8
#12+15=27

dict={'a':100,'b':200}
print(f'{dict["a"]}')

你可能感兴趣的:(python基础)