str1.split('\t', 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.
Например:
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']