3 ms·
No. It's more like what the following piece of code produces: def convert(xml): import re parsed = re.split(r"(<.+?>)", xml) output = pars
by rbehrends 3y ago
No. It's more like what the following piece of code produces:
def convert(xml):
import re
parsed = re.split(r"(<.+?>)", xml)
output = parsed[0]
tags_with_pos = []
for i in range(1, len(parsed), 2):
tags_with_pos.append((parsed[i], len(output)))
output += parsed[i+1]
return tags_with_pos, output