题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
while True:
try:
whole_string = input()
while len(whole_string) > 8:
print(whole_string[:8])
whole_string = whole_string[8:]
print( whole_string + '0' * (8-len(whole_string)))
except:
break
一开始的想法是先通过除法计算输出的语句的次数,然后再通过 for 来循环输出。后来发现输出一点,切除一点更加简单高效。
