1

I have the following String

text_clean = 'i am a person. i believe i can fly. i believe i can touch the sky.'

and the word

wd = 'can'

I could like to get all words after the wd but together with the . if it exists. So I would like to get ['fly.', 'touch']

I have tried

import re
re.findall(r'{} \b(\S+)\b'.format(wd),text_clean)

according to this question but the solution does not give me the .'s also

Abdul Niyas P M
  • 12,736
  • 2
  • 17
  • 36
quant
  • 3,328
  • 1
  • 21
  • 49

0 Answers0