题解 | #字符串分隔#

字符串分隔

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

while True:
    try:
        a = input()
        num = len(a)
        num_chu = num // 8
        num_yu = num % 8
        i = 0
        while True:
            if num <= 8:
                num_bu = 8 - num
                numstr = '0' * num_bu
                out_str = a[0 + i * 8:8 + i * 8] + numstr
                print(out_str)
                break
            else:
                out_str = a[0 + i * 8:8 + i * 8]
                num -= 8
                print(out_str)
                i += 1
    except:
        break

全部评论

相关推荐

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