我正在尝试在列表中附加日期,其代码如下。
t=(['%s (%s)'% (w[0], w[1]) for w in top_10_words_sans_stop_words])
#print t
today = datetime.date.today()
times_list.append({'title':t,'date':today})
print(times_list)
out_file = os.path.join('database', 'Tuesday','stopwords','timesofindia.json')
f = open(out_file, 'w')
f.write(json.dumps(times_list, indent=1))
f.close()
print('Wrote output file to %s' % (f.name, ))
但它给出了错误 那么这个错误的正确解决方案是什么?
datetime.date(2014, 3, 14) is not JSON serializable