Split a sentence by punctuations using Python

chad antonyliu2002 at yahoo.com
Fri Mar 5 23:44:53 CET 2004


I want to split sentences by using punctuations, numeric numbers as
the delimiters.

For example, suppose I have a text that contains sentences like so:

"To help you get there a bit faster, I will be driving at 120 miles an
hour (I am just kidding). Is that OK?"

Now, I want to get the following segments from this text:

To help you get there a bit faster
I will be driving at
miles an hour
I am just kidding
Is that OK

You know, string.split does not work for this objective.  So how can i
achieve this?  Thanks.



More information about the Python-list mailing list