题解 | #字符串分隔#

字符串分隔

http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7

这道题还是比较有趣的,它充分考查字符串的利用与循环机制。

import sys

input_str = input()

while len(input_str):
    if len(input_str)>=8:
        print(input_str[:8])
        input_str = input_str[8:]
    else:
        print(input_str+'0'*(8-len(input_str)))
        input_str = []
全部评论

相关推荐

12 收藏 评论
分享
牛客网
牛客企业服务