I am trying to put a file in a dictionary.
The file is like this:
1 some something something
2 go goforit doit
17 non so
I am trying something like this but is doesnt work:
def filetodic():
d={}
with open("file.txt") as f:
for line in f:
key = line.split()
return d
print filetodic()
EDIT: The key for every field in the dictionary needs to be the number that appears to be the first element in each line in the file.
Try this: