These functions respectively left-justify, right-justify and center a
string in a field of given width. They return a string that is at
least width characters wide, created by padding the string s with the
character fillchar (default is a space) until the given width on the
right, left or both sides. The string is never truncated.
您可以使用
ljust
执行以下操作:将打印以下内容:
从doc:
请注意,还可以使用format来获得相同的效果:
您还可以使用字符串格式化方法^{} :
相关问题 更多 >
编程相关推荐