V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
twor2
V2EX  ›  Python

关于 json.dumps 两种写法的区别

  •  
  •   twor2 · Oct 13, 2015 · 2523 views
    This topic created in 3852 days ago, the information mentioned may be changed or developed.

    如上图, separators 加和不加 有什么区别呐
    7 replies    2015-10-13 11:13:59 +08:00
    twor2
        1
    twor2  
    OP
       Oct 13, 2015
    我在文档 https://docs.python.org/2/library/json.html 看到的说明是

    Compact encoding

    紧凑代码?用途是什么
    binux
        2
    binux  
       Oct 13, 2015
    你没发现输出不一样吗?
    ljbha007
        3
    ljbha007  
       Oct 13, 2015
    少几个空格可以节约带宽
    FrankFang128
        4
    FrankFang128  
       Oct 13, 2015 via Android
    这么大区别都看不出来,肯定是直男
    twor2
        5
    twor2  
    OP
       Oct 13, 2015 via iPhone
    @FrankFang128
    @ljbha007
    @binux

    短一点我是看出来了,目的就是显示紧凑点?
    wy315700
        6
    wy315700  
       Oct 13, 2015 via Android
    @twor2 传输或者存储的时候节约空间啊
    ljbha007
        7
    ljbha007  
       Oct 13, 2015
    @twor2 空格传输的时候要占数据量的呀
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5394 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 07:33 · PVG 15:33 · LAX 00:33 · JFK 03:33
    ♥ Do have faith in what you're doing.