I
Iain King
I have some code that converts html into xhtml. For example, convert
all <i> tags into <em>. Right now I need to do to string.replace calls
for every tag:
html = html.replace('<i>','<em>')
html = html.replace('</i>','</em>')
I can change this to a single call to re.sub:
html = re.sub('<([/]*)i>', r'<\1em>', html)
Would this be a quicker/better way of doing it?
Iain
all <i> tags into <em>. Right now I need to do to string.replace calls
for every tag:
html = html.replace('<i>','<em>')
html = html.replace('</i>','</em>')
I can change this to a single call to re.sub:
html = re.sub('<([/]*)i>', r'<\1em>', html)
Would this be a quicker/better way of doing it?
Iain