> 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.
Why complicated?
<code>
import string
myStr = 'some text from which you want to delete some chars'
resultStr = s.translate(string.maketrans('', ''), 'nem')
print resultStr
</code>
Output : so txt fro which you wat to dlt so chars
You just have to use maketrans with empty strings. If string is
deprecated then I guess some other way of creating translation tables
will be provided.
HTH
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor