title: How to extract a group of values from a list after finding the group with the best "score", using python?
body: <p>I have a list ('dummy&quot;). I want to extract ONLY the values related to the best 'Score'. For example, from the list I should have the following values extracted:</p>
  <pre><code>    &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: inception_v4_299_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 121.8&quot;,
      &quot;Time(ms): 101.2&quot;,
      &quot;Inference: admiral&quot;,
      &quot;Score: 0.59375 &quot;,
      &quot;TPU_temp(°C): 57.05&quot;,
  
  </code></pre>
  <p>Why? Because &quot;Score: 0.59375 &quot;, is the highest value when compared to the other &quot;Scores&quot; in the list.</p>
  <p>How can I do that?</p>
  <p>Thank you</p>
  <p>THE CODE</p>
  <pre><code>#This is the list
  
  dummy = ['labels: imagenet_labels.txt \n', '\n', 'Model: efficientnet-edgetpu-S_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 23.1\n', 'Time(ms): 5.7\n', '\n', '\n', 'Inference: corkscrew, bottle screw\n', 'Score: 0.03125 \n', '\n', 'TPU_temp(°C): 57.05\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: efficientnet-edgetpu-M_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 29.3\n', 'Time(ms): 10.8\n', '\n', '\n', &quot;Inference: dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk\n&quot;, 'Score: 0.09375 \n', '\n', 'TPU_temp(°C): 56.8\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: efficientnet-edgetpu-L_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 45.6\n', 'Time(ms): 31.0\n', '\n', '\n', 'Inference: pick, plectrum, plectron\n', 'Score: 0.09766 \n', '\n', 'TPU_temp(°C): 57.55\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: inception_v3_299_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 68.8\n', 'Time(ms): 51.3\n', '\n', '\n', 'Inference: ringlet, ringlet butterfly\n', 'Score: 0.48047 \n', '\n', 'TPU_temp(°C): 57.3\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: inception_v4_299_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 121.8\n', 'Time(ms): 101.2\n', '\n', '\n', 'Inference: admiral\n', 'Score: 0.59375 \n', '\n', 'TPU_temp(°C): 57.05\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: inception_v2_224_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 34.3\n', 'Time(ms): 16.6\n', '\n', '\n', 'Inference: lycaenid, lycaenid butterfly\n', 'Score: 0.41406 \n', '\n', 'TPU_temp(°C): 57.3\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: mobilenet_v2_1.0_224_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 14.4\n', 'Time(ms): 3.3\n', '\n', '\n', 'Inference: leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea\n', 'Score: 0.36328 \n', '\n', 'TPU_temp(°C): 57.3\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: mobilenet_v1_1.0_224_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 14.5\n', 'Time(ms): 3.0\n', '\n', '\n', 'Inference: bow tie, bow-tie, bowtie\n', 'Score: 0.33984 \n', '\n', 'TPU_temp(°C): 57.3\n', '##################################### \n', '\n', 'labels: imagenet_labels.txt \n', '\n', 'Model: inception_v1_224_quant_edgetpu.tflite \n', '\n', 'Image: insect.jpg \n', '\n', '*The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory*\n', 'Time(ms): 21.2\n', 'Time(ms): 3.6\n', '\n', '\n', 'Inference: pick, plectrum, plectron\n', 'Score: 0.17578 \n', '\n', 'TPU_temp(°C): 57.3\n', '##################################### \n', '\n']
  
  
  ### This is to clean the data
  
  regex = re.compile(r'(\w+)\((.+)\):\s(.*)|(\w+:)\s(.*)')
  match_regex = list(filter(regex.match, dummy))
  match = [line.strip('\n').strip() for line in match_regex]  
  print(&quot;match list&quot;, match, &quot;\n&quot;)
  
  </code></pre>
  <p>THE 'dummy' LIST LOOKS LIKE THIS</p>
  <pre><code>[
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: efficientnet-edgetpu-S_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 23.1&quot;,
      &quot;Time(ms): 5.7&quot;,
      &quot;Inference: corkscrew, bottle screw&quot;,
      &quot;Score: 0.03125 &quot;,
      &quot;TPU_temp(°C): 57.05&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: efficientnet-edgetpu-M_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 29.3&quot;,
      &quot;Time(ms): 10.8&quot;,
      &quot;Inference: dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk&quot;,
      &quot;Score: 0.09375 &quot;,
      &quot;TPU_temp(°C): 56.8&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: efficientnet-edgetpu-L_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 45.6&quot;,
      &quot;Time(ms): 31.0&quot;,
      &quot;Inference: pick, plectrum, plectron&quot;,
      &quot;Score: 0.09766 &quot;,
      &quot;TPU_temp(°C): 57.55&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: inception_v3_299_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 68.8&quot;,
      &quot;Time(ms): 51.3&quot;,
      &quot;Inference: ringlet, ringlet butterfly&quot;,
      &quot;Score: 0.48047 &quot;,
      &quot;TPU_temp(°C): 57.3&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: inception_v4_299_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 121.8&quot;,
      &quot;Time(ms): 101.2&quot;,
      &quot;Inference: admiral&quot;,
      &quot;Score: 0.59375 &quot;,
      &quot;TPU_temp(°C): 57.05&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: inception_v2_224_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 34.3&quot;,
      &quot;Time(ms): 16.6&quot;,
      &quot;Inference: lycaenid, lycaenid butterfly&quot;,
      &quot;Score: 0.41406 &quot;,
      &quot;TPU_temp(°C): 57.3&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: mobilenet_v2_1.0_224_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 14.4&quot;,
      &quot;Time(ms): 3.3&quot;,
      &quot;Inference: leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea&quot;,
      &quot;Score: 0.36328 &quot;,
      &quot;TPU_temp(°C): 57.3&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: mobilenet_v1_1.0_224_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 14.5&quot;,
      &quot;Time(ms): 3.0&quot;,
      &quot;Inference: bow tie, bow-tie, bowtie&quot;,
      &quot;Score: 0.33984 &quot;,
      &quot;TPU_temp(°C): 57.3&quot;,
      &quot;labels: imagenet_labels.txt &quot;,
      &quot;Model: inception_v1_224_quant_edgetpu.tflite &quot;,
      &quot;Image: insect.jpg &quot;,
      &quot;Time(ms): 21.2&quot;,
      &quot;Time(ms): 3.6&quot;,
      &quot;Inference: pick, plectrum, plectron&quot;,
      &quot;Score: 0.17578 &quot;,
      &quot;TPU_temp(°C): 57.3&quot;,
  ]
  </code></pre>