I have a txt file like this:
1234 John Smith
2345 Joe Bloggs
12 Matt Kemp
etc.
I also have a copy of the text file with each value like "value". I want to create a dictionary in the form:
['1234': 'John Smith', '2345': 'Joe Bloggs', '12': 'Matt Kemp']
My current code is:
validclubs = {}
with open("validclubs.txt") as f:
for line in f:
(id, club) = line.split()
d[int(id)] = val
print (d)
but with both files I get ValueError: too many values to unpack (expected 2).