Python printf的使用方法
age = 4
name = ‘hmm’
print(‘my name is ‘,name,’age is ‘,age) #第一种方法。
my name is hmm age is 4
print(‘my name is %s, age is %s’ %(name,age))#第一种方法。
my name is hmm, age is 4
print(‘my name is {0} age is {1}’.fORMat(name,age))#第一种方法。
my name is hmm age is 4
相关文章