Domanda

So I have a large string with several similar things. I want to find part of a string but have part of it be irrelevant.

For example: "0" blah"11" "0" blah"3" "0" blah"6" "0" blah"600" "0"

I want to find ' blah"..." ' Where '...' is the number and I can get the value of '...'

Is there an easy way to do that?

È stato utile?

Soluzione

>>> import re
>>> re.findall(r'blah"(\d+)"','"0" blah"11" "0" blah"3" "0" blah"6" "0" blah"600" "0"')
['11', '3', '6', '600']
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top