把"list.csv"改成filename
def?csv2dict(fname):new_dict?=?{}
with?open(fname,?'rb')?as?f:
reader?=?csv.reader(f,?delimiter=',')
fieldnames?=?next(reader)
reader?=?csv.DictReader(f,?fieldnames=fieldnames,?delimiter=',')
for?row?in?reader:
new_dict[row['name']]?=?row['movie']
return?new_dict