String Manipulation

Josef Meile jmeile at hotmail.com
Wed Jul 13 14:29:12 EDT 2005


Hi,

>     for punctuation in punctuations:
>         line=line.replace(punctuation,'')
I would use maketrans or even a regex instead. However, If you care
about speed, it is well known that in some cases regex take more
time than multiple replaces. Even the maketrans could take more time
(I don't know; you may benchmark it -> homework)

Regards,
Josef




More information about the Python-list mailing list