Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 returns index of list if contains a word

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


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)

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  list.index() help qmfoam 3 68 3 hours ago
Last Post: deanhystad
  Function to return list of all the INDEX values of a defined ndarray? pjfarley3 2 155 Jul-10-2020, 04:51 AM
Last Post: pjfarley3
  Find index value in List Martin2998 3 319 May-12-2020, 02:17 PM
Last Post: deanhystad
  Compare Two Lists and Replace Items In a List by Index nagymusic 2 383 May-10-2020, 05:28 AM
Last Post: deanhystad
  Cant Append a word in a line to a list err "str obj has no attribute append Sutsro 2 229 Apr-22-2020, 01:01 PM
Last Post: deanhystad
  Python Speech recognition, word by word AceScottie 6 8,205 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  How to find something in a list using its index rix 1 300 Dec-20-2019, 04:12 PM
Last Post: stullis
  item = index position - list of list RavCOder 9 710 Dec-02-2019, 05:24 PM
Last Post: ThomasL
  IndexError: List index out of range issue Adem 1 1,152 Nov-01-2019, 10:47 PM
Last Post: ichabod801
  print a word after specific word search evilcode1 8 570 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019

Forum Jump:

Users browsing this thread: 1 Guest(s)