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
twor2
V2EX  ›  Python

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

  •  
  •   twor2 · 2015-10-13 04:59:08 +08:00 · 2056 次点击
    这是一个创建于 3126 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    Compact encoding

    紧凑代码?用途是什么
    binux
        2
    binux  
       2015-10-13 06:07:09 +08:00
    你没发现输出不一样吗?
    ljbha007
        3
    ljbha007  
       2015-10-13 07:42:00 +08:00
    少几个空格可以节约带宽
    FrankFang128
        4
    FrankFang128  
       2015-10-13 07:53:27 +08:00 via Android
    这么大区别都看不出来,肯定是直男
    twor2
        5
    twor2  
    OP
       2015-10-13 09:23:29 +08:00 via iPhone
    @FrankFang128
    @ljbha007
    @binux

    短一点我是看出来了,目的就是显示紧凑点?
    wy315700
        6
    wy315700  
       2015-10-13 09:28:20 +08:00 via Android
    @twor2 传输或者存储的时候节约空间啊
    ljbha007
        7
    ljbha007  
       2015-10-13 11:13:59 +08:00
    @twor2 空格传输的时候要占数据量的呀
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   981 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:37 · PVG 07:37 · LAX 16:37 · JFK 19:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.