Frage

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?

War es hilfreich?

Lösung

>>> import re
>>> re.findall(r'blah"(\d+)"','"0" blah"11" "0" blah"3" "0" blah"6" "0" blah"600" "0"')
['11', '3', '6', '600']
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top