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
  • 18,035
  • 2
  • 25
  • 46
quant
  • 4,062
  • 5
  • 29
  • 70

0 Answers0