题解 | #字符串分隔#

字符串分隔

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 = []
全部评论

相关推荐

不愿透露姓名的神秘牛友
02-25 17:03
点赞 评论 收藏
分享
评论
16
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务