1. 如果让字符串居中显示,有哪些方法
center方法
format方法
2. 请使用center方法让字符串居中显示,两侧显示#号
print('<'+'hello'.center(30) + '>')
print('<'+'hello'.center(30, '#') + '>')
print('<{:^30}>'.format('hello'))
print('<{:#^30}>'.format('hello'))
< hello >
<############hello#############>
< hello >
<############hello#############>
浙公网安备 33010602011771号