0

Text= "hello, I'm trying to __ extract texts __ in this string"

Good day! Everyone, I'm trying to extract the words after the double underscore and stop at the double underscore after the word. I've tried using Regex(re.search()) but I don't get what I want.

Text= "hello, I'm trying to __ extract texts __ in this string"

text = text.split()
new=[text]
for word in new:
    if word.startswith('__') and word.endswith('__'):
        print(word)

This is what I tried before using Regex as a second option, I would appreciate as you help me out :-)

0 Answers0