Chinaunix
标题:
{0:30^30}
[打印本页]
作者:
tomer
时间:
2014-11-14 10:26
标题:
{0:30^30}
print("decimal hex chr {0:^30}".format("name"))
decimal hex chr name
{0:^30}是什么意思?
作者:
whitelotus19
时间:
2014-11-14 11:06
>>> print("decimal hex chr {0:^30}".format("name"))
decimal hex chr name
>>> print("decimal hex chr {0:^30}".format("name"),'test')
decimal hex chr name test
>>> print("decimal hex chr {0:<30}".format("name"),'test')
decimal hex chr name test
>>> print("decimal hex chr {0:>30}".format("name"),'test')
decimal hex chr name test
>>> print("decimal hex chr {1:>30}".format("name","abc"),'test')
decimal hex chr abc test
>>>
复制代码
00005.JPG
(23.37 KB, 下载次数: 21)
下载附件
2014-11-14 11:05 上传
作者:
tomer
时间:
2014-11-14 12:45
回复
2#
whitelotus19
"decimal hex chr {0:^30}".format("name")
{0:^30}<--0代表的是name;那么后面的^30是什么意思??
作者:
whitelotus19
时间:
2014-11-14 14:56
居中对齐,宽度30
作者:
tomer
时间:
2014-11-14 16:34
回复
4#
whitelotus19
谢谢,明白了。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2