Sign up to request clarification or add additional context in comments.
Comments
0
Just split the line and check if one of the items starts with your desired string:
TEST = 'GAMES HELLO VAUXHALL RUNS=15 TESTED=3'
def extract(s: str):
for i in s.split():
if i.startswith("RUNS="):
return int(i.split("=")[1])
print(extract(TEST))