fork download
  1. import re
  2. text="\n1.2.2. ROAD LOAD PARAMETERS \nf0 \n227.4 \nf1 (N/(km/h)) \n0.149"
  3. m = re.search(r'\b(1\.2\.2\. ROAD LOAD PARAMETERS).*((?:\n.*){2})', text)
  4. d = {}
  5. if m:
  6. d[m.group(1).strip()] = m.group(2).replace('\n', '').strip()
  7.  
  8. print(d)
Success #stdin #stdout 0.02s 9644KB
stdin
Standard input is empty
stdout
{'1.2.2. ROAD LOAD PARAMETERS': 'f0 227.4'}