format的三种用法

时间:2017-12-12 22:50:50   收藏:0   阅读:225

1,类似格式话输出的占位符s%.

#print(‘my name is {} ,I like {} ‘,format(‘xiong‘,‘reading‘))

2,  

#print(‘{0} {1} {0}’,format(‘a’,‘b’))

3,

#print(‘{name} {age}’,format(‘a’,18))

 

原文:http://www.cnblogs.com/xiongrongqin/p/8029927.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!