推荐学习书目
› 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
reaCodes
V2EX  ›  Python

天天基金 api 返回的这种 js 格式的数据怎么用 Python 处理?

  •  
  •   reaCodes ·
    zhatlas · Jul 19, 2018 · 4852 views
    This topic created in 2989 days ago, the information mentioned may be changed or developed.
    http://fundgz.1234567.com.cn/js/003095.js

    例如这个基金,怎么使用不同键下边的键值?
    5 replies  •  2018-07-19 17:20:49 +08:00
    yoshiyuki
        1
    yoshiyuki  
       Jul 19, 2018
    这个应该是 JSONP 用的,你搜索一下看看爬虫怎么应对 JSONP 就好了,网上肯定有的
    songjiaxin2008
        2
    songjiaxin2008  
       Jul 19, 2018
    其实就简单的去头去尾就可以了,然后当 json 来处理。因为在网页当中 JSONP 也是这么使用的,回调函数必须与约定的一致。最多也就最后有没有分号的差别。
    graysheeep
        3
    graysheeep  
       Jul 19, 2018
    jsonp 啊兄弟
    biaoliruyi
        4
    biaoliruyi  
       Jul 19, 2018
    JSONP 只是把 json 包装了一层 你把包装层去掉就行了
    reaCodes
        5
    reaCodes  
    OP
       Jul 19, 2018
    @yoshiyuki @songjiaxin2008 @graysheeep @biaoliruyi 可以,明白了,已经完美解决。可惜的是为什么美人把它做成个库,直接调用就行。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   843 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 21:38 · PVG 05:38 · LAX 14:38 · JFK 17:38
    ♥ Do have faith in what you're doing.