【发布时间】:2016-01-13 11:22:00
【问题描述】:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
d = {'a':'текст',
'b':{
'a':'текст2',
'b':'текст3'
}}
print(d)
w = open('log', 'w')
json.dump(d,w, ensure_ascii=False)
w.close()
它给了我: UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-5: ordinal not in range(128)
【问题讨论】:
标签: arrays dictionary unicode