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.html#l2h-268

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to