zfill函数 功能 为字符串定义长度, 如不满足,缺少的部分用0填充 用法 newstr = string.zfill(width) 参数 width: 新字符串希望的宽度 注意事项 与字符串的字符无关 如果定义长度小于当前字符串长度,则不发生变化 代码 # coding:utf-8 heart = 'love' if __name__ == '__main__': print(' t ' + heart) print('t ' + heart...
hn.icodeq.com1 min read
No responses yet.