0

Hi I'm trying to split strings by ".\n\n" or ". \n\n" instead of "\n\n". But when I tried the following code, the string was splitted by "\n\n":

import re    
text = 'Thanks.\n\n This is the first time. \n\n Yes \n\n indeed.'
re.split('. \n\n|.\n\n', text)

Here's the result:

['Thanks', ' This is the first time', ' Ye', ' indeed.']

What I want to get is

['Thanks', ' This is the first time', 'Yes \n\n indeed.']

In addition, could I split strings by

"?|!|." + "\n\n"?
hao3 feng
  • 11
  • 2

0 Answers0