2018年11月20日星期二

xml和json无法显示中文

解决办法:在相关语句中添加“encoding='utf-8'”。
如:

xmldoc.write(xmlpath+xmllist[i], encoding='utf-8')

json.dump(instance, open(save_path, 'w', encoding='utf-8'), ensure_ascii=False, indent=1)

with open(path, "r", encoding='utf-8') as f:

没有评论:

发表评论

Failed to find TIFF library

ImportError: Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|.. 解决方法: ...