dictionary = {}
file = 'lightning.txt'
with open(file) as d:
for line in d:
pa = line.split()
dictionary[pa[0]] = pa[1:]
print(dictionary)
I have a text file that shows lightning players and their goals and assists, it is set up like this:
Stamkos
46
50
Hedman
30
50
Point
40
50
All on separate lines, I am trying to write a program that sends this text file to a dictionary although my output is not displaying how I want it. the dictionary is coming out as {'Stamkos': [], '46': [], '50': [],
I am trying to get rid of the empty lists and just have the name as the key and the goals and assists as the values but nothing is working.