print('{:.2g}'.format(1.35))1.4print('{:.2g}%'.format(1.35))1.4%print('{:.2%}'.format(1.35))135.00%# 实战练习
b =[]
data =[[0,0.922584,0.537336,0.0384615,0.0720395]]
b ='({:.3g},{:.3g}),({:.3g},{:.3g})'.format(*data[0][1:])print(b)(0.923,0.537),(0.0385,0.072)
i =1print(f'这样也可以{i}')
这样也可以1
a =[1,2,3]
b =['a',5,6]
c =zip(a,b)for x,y in c:print("x是{},类型是{}".format(x,type(x)))print("y是{},类型是{}".format(y,type(y)))
x是1,类型是<class'int'>
y是a,类型是<class'str'>
x是2,类型是<class'int'>
y是5,类型是<class'int'>
x是3,类型是<class'int'>
y是6,类型是<class'int'>