题解 | #字符串分隔#
字符串分隔
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个字符的情况