浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Python load json file with UTF-8 BOM header - Stack Overflow


12
down vote

accepted

You can open with codecs:

import json
import codecs

json.load(codecs.open('sample.json','r','utf-8-sig'))

or decode with utf-8-sig yourself and pass to loads:

json.loads(open('sample.json').read().decode('utf-8-sig'))
posted on 2014-05-16 06:51  lexus  阅读(680)  评论(0编辑  收藏  举报