题解 | #字符串分隔#

字符串分隔

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

lines = []
while True:
    try:
        lines.append(input())
    except:
        break

newLines = []
for l in lines:
    if len(l) <= 8:
        newLines.append(l)
    else:
        counts = int(len(l)/8)
        for i in range(0, counts+1):
            if i*8 < len(l):
                end = i*8+8
                if end >= len(l):
                    end = len(l)
#                 print(i*8)
#                 print(end)
#                 print(l[int(i*8):int(end)])
                newLines.append(l[int(i*8):int(end)])
# print(newLines)
for l in newLines:
    if len(l) < 8:
        string = l
        interval = 8 - len(l)
        for i in range(0, interval):
            string += '0'
        l = string
    print(l)
全部评论

相关推荐

Beeee0927:是缅甸园区吗
点赞 评论 收藏
分享
06-14 19:09
门头沟学院 Java
darius_:给制造业搞的,什么物料管理生产管理,设备管理点检,最最关键的就是一堆报表看板。个人觉得没啥技术含量都是些基本的crud,但是业务很繁琐那种
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 12:02
ssob上原来真有BOSS啊
硫蛋蛋:这种也是打工的,只不是是给写字楼房东打工
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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