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

Python json 格式化 结果为 null

  •  
  •   Oane · 2019-03-04 10:14:35 +08:00 · 3547 次点击
    这是一个创建于 1881 天前的主题,其中的信息可能已经有所发展或是发生改变。

    爬虫数据存储,json 格式化,最后检查时会有 null 的情况 似乎还是随机的 第一次跑和第二次跑 null 的情况不同 各位有遇到过类似情况吗?

    9 条回复    2019-03-04 16:37:00 +08:00
    awanabe
        1
    awanabe  
       2019-03-04 10:32:01 +08:00
    格式化是什么? dumps?
    json.dumps(None)
    > 'null'
    Oane
        2
    Oane  
    OP
       2019-03-04 10:53:51 +08:00
    dump 数据都 print 出来了 但是最后的结果是 null
    summerwar
        3
    summerwar  
       2019-03-04 11:45:58 +08:00   ❤️ 2
    这种情况麻烦直接贴代码 靠猜是解决不了问题的
    Marsss
        4
    Marsss  
       2019-03-04 12:03:42 +08:00
    放码过来
    qwertyzzz
        5
    qwertyzzz  
       2019-03-04 12:30:21 +08:00
    @Oane 数据不标准 可能数据哪有问题
    shintendo
        6
    shintendo  
       2019-03-04 14:02:19 +08:00
    提问的艺术……
    aaa5838769
        7
    aaa5838769  
       2019-03-04 14:34:05 +08:00
    应该是数据没有标准,可以加个判断。
    cnoder
        9
    cnoder  
       2019-03-04 16:37:00 +08:00
    抓 json 异常
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2791 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 05:32 · PVG 13:32 · LAX 22:32 · JFK 01:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.