How do loose the /012

Alex alex at somewhere.round.here
Tue Oct 5 19:34:27 EDT 1999


If you only want a return after each full stop, and not other sentence
ending punctuation, perhaps this would do the trick:

>>> text='''
AAAA
AA
A.

BBBBBB
B.

C.

DDDD
DD.
'''
... ... ... ... ... ... ... ... ... ... ... ... >>> 
>>> import re
>>> text=re.sub('\n','',text)
>>> text=re.sub('\.','.\n',text)
>>> print text
AAAAAAA.
BBBBBBB.
C.
DDDDDD.

Alex.




More information about the Python-list mailing list