我就是这样的人:
-----hello------现在,我知道可以通过定义和打印宽度来打印符号,但是如何在其中插入文本呢?谢谢。
发布于 2015-09-30 23:38:16
你应该试试这样的东西:
print 'hello'.center(16,'-')或者像这样:
print '{:-^16}'.format("hello")这将把宽度设置为16,并用'-'填充字符串。
查看教程here。
发布于 2015-09-30 23:39:02
使用字符串格式
"-----%s------" %("hello")
"-----{}------".format("hello")https://stackoverflow.com/questions/32870216
复制相似问题