我有一个字符串叫做message
.
message = "Hello, welcome!\nThis is some text that should be centered!"
我试着把它放在一个默认的终端窗口的中心,也就是说,宽度为80,用下面的语句:
print('{:^80}'.format(message))
其中打印:
Hello, welcome!
This is some text that should be centered!
我期待着这样的事情:
Hello, welcome!
This is some text that should be centered!
有什么建议吗?