首页 > 编程语言 > 详细

Python format格式化输出

时间:2016-04-25 15:02:25      阅读:338      评论:0      收藏:0      [点我收藏+]

http://www.jb51.net/article/63672.htm

推荐参考

 1 >>> ‘{0},{1}‘.format(‘hello‘,‘python‘)
 2 ‘hello,python‘
 3 >>> ‘{0} {1}‘.format(‘hello‘,‘python‘)
 4 ‘hello python‘
 5 >>> ‘your name:{name}‘.format(name=‘tom‘)
 6 ‘your name:tom‘
 7 >>> p=[‘123‘,45]
 8 >>> ‘{0[0]}{0[1]}‘.format(p)
 9 ‘12345‘
10 >>> "{:>10}".format(‘1111‘)
11 ‘      1111‘

记住几个常用的用法就行,其余的要有个印象!

Python format格式化输出

原文:http://www.cnblogs.com/dream-for/p/5430643.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!