V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
bestehen
V2EX  ›  问与答

Python 在 json.dumps 报错

  •  
  •   bestehen · 2018-08-03 02:21:03 +08:00 · 2356 次点击
    这是一个创建于 2311 天前的主题,其中的信息可能已经有所发展或是发生改变。
    [{"found_year":found_year,"jg_type":jg_type,"area":area,"source_gw_link":source_gw_link},{"company_news":json.dumps(OrderedDict (sorted(company_news.items())),encoding="Utf-8",ensure_ascii=False)}, {"name":name,"sex":sex,"company":company,"position":position,"role" :role, "edu_experience":json.dumps(OrderedDict (sorted(edu_experience.items())),encoding="Utf-8",ensure_ascii=False),"work_experience": json.dumps(OrderedDict (sorted(work_experience.items())),encoding="Utf-8",ensure_ascii=False)}, {"lingyu":lingyu,"jiguan":jiguan,"lunci":lunci,"jieduan":jieduan,"jieshao":jieshao,"money_type":money_type,"touzianlie":json.dumps(OrderedDict (sorted(tzanli.items())),encoding="Utf-8",ensure_ascii=False)},{"person_news":json.dumps(OrderedDict(sorted(person_news.items())),encoding="Utf-8",ensure_ascii=False)}])
    File "/usr/lib64/python3.4/json/__init__.py", line 237, in dumps
    **kw).encode(obj)
    TypeError: __init__() got an unexpected keyword argument 'encoding'

    因为我在 json.dumps 插入数据的时候是 unicode 这样写 但是报错是这样的
    Leigg
        1
    Leigg  
       2018-08-03 09:47:12 +08:00
    论 “如何提问”
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1603 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 16:58 · PVG 00:58 · LAX 08:58 · JFK 11:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.