Stella981 Stella981
2年前
Python中print格式化输出
截取字符串输出,下面例子将只输出字符串的前3个字母str"abcdefg"print"%.3s"%strabc按固定宽度输出,不足使用空格补全,下面例子输出宽度为10str"abcdefg"print