>>> print('{0}111{1}222'.format(age, name))
20111hh222
>>> print('{0:.3f}'.format(1.0/3))
0.333
>>> print('{0:.3f}'.format(1/3))
0.333
>>> print('{0:_^11}'.format('hello'))
___hello___
>>> print('{name}love{book}'.format(name="gaixin", book="Harru"))
gaixinloveHarru
>>> print('{}111{}222'.format(age, name))
20111hh222
python格式化
最新推荐文章于 2023-09-09 10:33:53 发布