<div dir="ltr">oops i forgot to count lines, <br><br>MainDictionary = {}<br>N = 0<br>M = 0<br>for line in open('data_file', 'r'):<br> if line:<br> if M < 3:<br> N += 1<br> M += 1<br>
a, b = line.split(" = ") # "=" is in between spaces whish gives you only two variables.<br>
if a == 'Field': <br> MainDictionary[N] == {}<br> elif a == 'Index':<br> MainDictionary[N]['Value'] = {b}<br> else:<br> a, b = line.split(" = ") # "=" is in between spaces whish gives you only two variables.<br>
if a == 'Field': <br>
MainDictionary[N] == {}<br>
elif a == 'Index':<br>
MainDictionary[N]['Value'] = {b}<br> M = 0<br><br> <br><br><br></div>