我使用python 3.4.3设置了virtualenv并尝试从json.decoder导入JSONDecodeError
from json.decoder import JSONDecodeError (I think its valid in python3 ? But why not working for me ?)
但这是行不通的。仅以下情况有效:
from simplejson import JSONDecodeError
我是怎么做的?
virtualenv venv --no-site-packages -p python3
pip install ipython
ipython
from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'
根据3.4.x docs的说明,ValueError
当JSON解码失败时,将引发plain 。
JSONDecodeError
从3.5.x开始提供该类。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句