Python JSON module has no attribute 'dumps'

前端 未结 10 1746
攒了一身酷
攒了一身酷 2021-01-01 09:14

I am running Python 2.7 (x64 Linux) and trying to convert a dict to a JSON object.

>>> import sys
>>> sys.version_info
sys.ver         


        
10条回答
  •  感情败类
    2021-01-01 09:28

    You may have another script in your Python path called "json", which you are importing by accident. You could resolve this either by renaming the one under your control or using

    from __future__ import absolute_import
    

提交回复
热议问题