查看Python笔记的源代码
←
Python笔记
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
=== Format === <source lang=python> #!/usr/bin/python #width = 10,precise = 3,align = left print "PI = %10.3f" %(math.pi) # don't add the '\n' at the end of line print "PI = %10.3f" %(math.pi), #width = 10,precise = 3,align = rigth print "PI = %-10.3f" % math.pi </source> Output: <source lang=bash> PI = 3.141593 PI = 3.142 </source> <source lang=bash> Python 2.7.9 (default, Mar 1 2015, 12:57:24) >>> print "%.3s " % ("jcodeer") #precise = 3 jco >>> print "%.*s" % (4,"jcodeer") #precise = 4 jcod >>> print "%10.3s" % ("jcodeer") #width = 10,precise = 3 jco >>> </source> <source lang=python> fmat = "%r %r %r %r" print fmat % (1, 2, 3, 4) print fmat % ("one", "two", "three", "four") print fmat % (True, False, False, True) </source> <source lang=bash> 1 2 3 4 'one' 'two' 'three' 'four' True False False True </source> <source lang=python> print('{0:.3}'.format(0.3333333)) #print('{0:.3}'.format(1/3)) print('{0:_^11}'.format('Hello')) print('{0:+^11}'.format('Hello')) print('{name} wrote {book}'.format(name='Jack', book='Hello world')) </source> <source lang=bash> PI = 3.141593 PI = 3.142 0.333 ___Hello___ +++Hello+++ Jack wrote Hello world </source> <br><br>
返回到
Python笔记
。
个人工具
18.119.192.100
该IP地址的讨论
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面