I am trying to read in this text file.
A B C D
1 5 6 7
2 8 9 10
3 .......
4 .......
The letter are brought in as a line, then I just bring in all the values as floats as
with open('file.txt', 'r') as f:
headings = f.readline()
numbers = [float(n) for n in f.read().split()] #read values to the 'numbers' as a list
print numbers
So I have a long list of all the integers.
But I want the dictionary in this format:
my_dict( { 1: [5,6,7], 2:[8,9,10] } )
so the first column of files numbers are the keys, and the rest are a list correlating to their respective key.
I am setting up every 4th value as a key with a loop, but how can I easily get the rest of the values as a list into that respective key.