str1.split('', n)[:-1]
str.split
has an optional second argument which is how many times to split. We remove the last item in the list (the leftover) with the slice.
For example:
a = 'foo,bar,baz,hello,world'
print(a.split(',', 2))
# ['foo', 'bar', 'baz,hello,world'] #only splits string twice
print(a.split(',', 2)[:-1]) #removes last element (leftover)
# ['foo', 'bar']
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…