Micro-PEP: str.translate(None) to mean identity translation

Michael Spencer mahs at telcopartners.com
Fri Apr 29 21:50:18 EDT 2005


Bengt Richter wrote:
> Just thought None as the first argument would be both handy and mnemonic,
> signifying no translation, but allowing easy expression of deleting characters,
> e.g.,
> 
>    s = s.translate(None, 'badcharshere')
> 
> Regards,
> Bengt Richter

+1

Michael




More information about the Python-list mailing list