use*_*115 5 python simplejson python-3.x
我使用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 ?)
Run Code Online (Sandbox Code Playgroud)
但它没有用.只有下面工作:
from simplejson import JSONDecodeError
Run Code Online (Sandbox Code Playgroud)
我怎么做的?
virtualenv venv --no-site-packages -p python3
pip install ipython
ipython
from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'
Run Code Online (Sandbox Code Playgroud)
Łuk*_*ski 16
根据3.4.x docs,ValueError当JSON解码失败时会引发plain .
JSONDecodeErrorclass从3.5.x开始提供.
| 归档时间: |
|
| 查看次数: |
8763 次 |
| 最近记录: |