题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
receive = input() def spilt_str1(string): for _ in range(8 - len(string)): string = string + "0" return string def spilt_str2(string): return [string[i : i + 8] for i in range(0, len(string), 8)] if len(receive) <= 8: receive = spilt_str1(receive) print(receive) else: receive = spilt_str2(receive) if len(receive[-1]) <= 8: receive[-1] = spilt_str1(receive[-1]) for i in receive: print(i) else: for i in receive: print(i)