format方法 与%s等格式化方法一样,实现字符串格式化 >>> '{} is {} years old'.format('bob',12) 'bob is 12 years old' >>> '{} is {} years old'.format(12,'bob') '12 is bob years old' >>> '{1} is {0} years old'.format(12,'bob') 'bob is 12 years old' 欢迎大家观看我的视频教程:Python入门到进阶