"W W" <[EMAIL PROTECTED]> wrote
Is there a faster way to strip punctuation from a string than this?
Yes
from string import ascii_letters
def strip_punctuation(mystring):
newstring = ''
for x in mystring:
if x in ascii_letters:
newstring += x
This is very slow sinc
On Thu, May 29, 2008 at 1:35 PM, W W <[EMAIL PROTECTED]> wrote:
> Is there a faster way to strip punctuation from a string than this?
def strip_punctuation(my_string):
return ''.join(c for c in my_string if c in ascii_letters)
or use str.translate():
http://docs.python.org/lib/string-methods.ht
Is there a faster way to strip punctuation from a string than this?
from string import ascii_letters
def strip_punctuation(mystring):
newstring = ''
for x in mystring:
if x in ascii_letters:
newstring += x
else:
pass
return newstring
In my decr