def split_and_keep(s, sep):
    if not s:
        return ['']
p = chr(ord(max(s)) + 1)
return s.replace(sep, sep + p).split(p)
for s in test_strings:
    print(split_and_keep(s, '<'))
unicode_max_char = chr(1114111)
ridiculous_string = '<Hello>' + unicode_max_char + '<World>'
print(split_and_keep(ridiculous_string, '<'))
In Python, how do I split a string and keep the separators?