-2
안녕하세요. 파일에 사전을 저장하고 싶지만 코드가 작동하지 않습니다. 여기사전을 파일로 작성하는 방법 Python?
코드 :
d=open('dict.txt', 'w')
for key, v in dict_ens.iteritems(): # dict_ens is another dict i have
dict_ens[key]=dict_ens[key][2:]
if key in enstts: #
d.write(key, v)
else :
d.write('no key')
d.close()
그 무슨 문제가 될 수 ???
http://stackoverflow.com/questions/7100125/ stored-python-dictionaries, http://stackoverflow.com/questions/17322273/store-a-dictionary-in-a-file-for-later-retrieval, http://stackoverflow.com/questions/19201290/how- 파이썬에서 사전 파일로 저장하기,이 질문의 많은 사본. –