[Tutor] code review please

Kent Johnson kent37 at tds.net
Wed Dec 28 14:06:03 CET 2005


Brian van den Broek wrote:
> def punctuation_split(sequence):
>      '''returns list of character sequences separating punctuation 
> characters'''
>      for mark in punctuation:
>          sequence = sequence.replace(mark, ' %s ' %mark)
>      return sequence.split(' ')

You should look at re.split().

Kent



More information about the Tutor mailing list