
python中 header_format='%-*s%*s' 的3.0以上版本新写法
想问一下这个回答中http://zhidao.baidu.com/question/455611805.htmlpy3.x兼容但推荐新写法了中的新写法是什么?谢谢!...
想问一下这个回答中 http://zhidao.baidu.com/question/455611805.html py3.x兼容但推荐新写法了
中的 新写法是什么?谢谢! 展开
中的 新写法是什么?谢谢! 展开
展开全部
python3的格式语法推荐以“{}”为占位符
以上格式写成"{:<{}}{:>{}}"
比如
>>> "{:<10}|{:>15}".format("hello","world")
'hello | world'
>>> "{:<{}}|{:>{}}".format("hello","10","world","15")
'hello | world'
以上格式写成"{:<{}}{:>{}}"
比如
>>> "{:<10}|{:>15}".format("hello","world")
'hello | world'
>>> "{:<{}}|{:>{}}".format("hello","10","world","15")
'hello | world'
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询