This is my dictionary structure
dic = {'tt3832096': ['remake', 'horror-movie-remake', 'flesh-eating-virus', 'gore'],
'tt6217804': ['chainsaw', 'sequel', 'second-part', 'mable-simmons-character']}
I want to save it in csv file like this:
movie id keyword
tt3832096 ['remake', 'horror-movie-remake', 'flesh-eating-virus', 'gore']
tt6217804 ['chainsaw', 'sequel', 'second-part', 'mable-simmons-character']
I have tried this:
with open('test.csv', 'w') as f:
for key in dic.keys():
f.write("%s:%s\n"%(key,dic[key]))
But it places each term of value in a cell. Is there a better way?