题解 | #字符串分隔#

字符串分隔

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

while True:
    try:
        line = input()
        if line == "":
            break

        length = len(line)

        mod_res = length % 8
        if mod_res != 0:
            need = 8 - mod_res
            tab = "0" * need
            line = line + tab
        count = int(len(line) / 8)
        for i in range(count):
            print(line[i * 8 : (i + 1) * 8])
    except:
        break

注意正好包含8个字符的情况

全部评论

相关推荐

牛客87317764...:然后客户端边学边投,学个1个月投不进去都是正常的,这玩意非常看运气
投递快手等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务