In [9]:
with open("grades.txt","r") as f:
    data = f.read()
#print(data,len(data))
#records = data.splitlines()
records = data.split('\n')
#print(records)
for record in records:
    print(record.split(':'))
f.close()
['Jones', 'CSC 1301', '4', 'A']
['Jones', 'CSC 1302', '4', 'A']
['Jones', 'CSC 2720', '3', 'B']
['Smith', 'CSC 1301', '4', 'B']
['Smith', 'CSC 1302', '4', 'B']
['Smith', 'CSC 2720', '3', 'A']
['Blake', 'CSC 1301', '4', 'B']
['Blake', 'CSC 1301', '4', 'B']
['Blake', 'CSC 1301', '4', 'B']
['Blake', 'CSC 1301', '4', 'B']
In [10]:
grades = {}
grades['Jones'] = [('CSC 1301',4,'A'),
                   ('CSC 1301',4,'A'),
                   ('CSC 2720',3,'B')]
In [11]:
grades
Out[11]:
{'Jones': [('CSC 1301', 4, 'A'), ('CSC 1301', 4, 'A'), ('CSC 2720', 3, 'B')]}
In [ ]: