[Tutor] Remove specific chars from a string

Kent Johnson kent37 at tds.net
Mon Apr 14 21:04:29 CEST 2008


Malcolm Greene wrote:
> What is the Pythonic way to remove specific chars from a string? The
> .translate( table[, deletechars]) method seems the most 'politically
> correct' and also the most complicated.

Most 'correct' and also by far the fastest. This recipe makes it a bit 
easier to use:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303342

Kent


More information about the Tutor mailing list