Python Forum
returns index of list if contains a word - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: returns index of list if contains a word (/thread-20979.html)



returns index of list if contains a word - zarize - Sep-09-2019

Hi,

how can i return index from the list if it contains special character + values?

example:

line1: [word1], [word2], [$300]

line2: [$4000], [word2], [word3]

How to return index when it starts with "$" to get from first line "$300" and from second line "$4000"?

Found answer:
import re


re.findall(r'[$]\w+', text)