%d可以实现对数字的格式化
num = int(input('how old are you:')) print('my age is %d'%num)
%f可以实现对小数的格式化
print('prince is %f'%4.99)
输出的是prince is 4.990000,如果想要保留2位小数,在f前面加数字2即可
%s用来替换一段字符串
name='arashi' print('%s is a great gruop'%name)
%d可以实现对数字的格式化
num = int(input('how old are you:')) print('my age is %d'%num)
%f可以实现对小数的格式化
print('prince is %f'%4.99)
输出的是prince is 4.990000,如果想要保留2位小数,在f前面加数字2即可
%s用来替换一段字符串
name='arashi' print('%s is a great gruop'%name)