题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
def call_input(): return input() # 输入一个字符串,请按长度为8拆分每个输入字符串并进行输出; # 长度不是8 整数倍的字符串请在后面补数字0,空字符串不处理。 def split_and_output(s): if len(s) == 0: print("00000000") return n = 8 for i in range(0, len(s), n): if i + n > len(s): s += "0" * (n - (len(s) - i)) print(s[i : i + n]) split_and_output(call_input())