19.07.13 19:22, Steven D'Aprano написав(ла): > I also expect that the string replace() method will be second fastest, > and re.sub will be the slowest, by a very long way. The string replace() method is fastest (at least in Python 3.3+). See implementation of html.escape() etc.