刚刚 学习了一下其他人的题解,发现 有更简单的 ljust() 函数

while True:
    try:
        temp = input()
        while(len(temp)>0):
            print(temp[:8].ljust(8,"0"))
            temp = temp[8:]
    except:
        break

ljust 这个函数,ljust(width, string) 指定长度,并且用确定的 string 填充剩下的空位
同时,用 temp[8:0] 来更新字符串的方式也很好,比我自己想到的简便多了