V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
myyou
V2EX  ›  Python

python 中 simplejson 和 json 的区别是什么?

  •  
  •   myyou · 2016-04-22 16:15:26 +08:00 · 6658 次点击
    这是一个创建于 2929 天前的主题,其中的信息可能已经有所发展或是发生改变。
    5 条回复    2016-04-23 15:16:49 +08:00
    liyj144
        1
    liyj144  
       2016-04-22 16:25:04 +08:00   ❤️ 1
    参考 http://stackoverflow.com/questions/712791/what-are-the-differences-between-json-and-simplejson-python-modules , simplejson 更新速度频繁些,使用 C 类库的情况下速度也要快很多, 但是 json 库在 python2.6 之后已经内置了,可以直接引用。
    myyou
        2
    myyou  
    OP
       2016-04-22 16:44:57 +08:00
    @liyj144 明白了,谢谢
    antiagainst
        3
    antiagainst  
       2016-04-23 08:12:45 +08:00   ❤️ 1
    simplejson 的 error message 要好于 json 。
    ming2281
        4
    ming2281  
       2016-04-23 10:24:50 +08:00
    有 C 的实现, 速度不要太快!
    myyou
        5
    myyou  
    OP
       2016-04-23 15:16:49 +08:00
    @ming2281 按照 liyj144 提供的测试,来看 simplejson 在 loads 是要快, dumps 要慢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5549 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 08:16 · PVG 16:16 · LAX 01:16 · JFK 04:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.