The input file looks like this:
A 3.00 B 4.00 C 5.00 D 6.00
E 3.20 F 6.00 G 8.22
H 9.00
I 9.23 J 89.2
K 32.344
And I am wanting the characters to be the keys in a dictionary while the floats being the values.
Here is the non-working fail that I have so far.
def main():
#Input File
reader = open('candidate.txt', 'r'
my_dictionary = {}
i=0
for line in reader.readlines():
variable = line.split(' ')[i]
value = line.split(' ')[i+1]
my_dictionary[variable]= value
i+=2
print my_dictionary
if __name__ == '__main__':
main()