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

Python post 请求参数的问题

  •  
  •   bestehen · Jul 30, 2018 · 3341 views
    This topic created in 3023 days ago, the information mentioned may be changed or developed.
    10 replies  •  2018-07-30 17:38:45 +08:00
    hicdn
    hicdn
    Jul 30, 2018
    1
    data 是 str,param 是 dict
    param = {'a':1, 'b':2}
    data = 'a=1&b=2'
    KeatingSmith
    KeatingSmith
    Jul 30, 2018
    2
    你可以这样理解,

    param 出现在 URL 地址上,

    data 不出现。
    bestehen
    bestehen
    OP
    Jul 30, 2018
    3
    @KeatingSmith 出现在 url 地址上直接 get 不就可以了
    bestehen
    bestehen
    OP
    Jul 30, 2018
    4
    @hicdn
    一个网站的 Form_data post 参数是这样的,那我是传 Data 还是 param ?因为你这样看也不知道是 dict 还是 str
    page: 1
    num: 50
    w:
    ptype: qmp_pc
    version: 2.0
    unionid: ETXncbCRyisjw/hr0zeTaonhpvkz/81ntwbBWAKYE4wdmhbtHCwxkjwb+0gjVdRzeJWqqIs6kiQsM8IbOYgM5A==
    jtype: vip
    time_token: 1532254367533
    welkinzh
    welkinzh
    Jul 30, 2018
    5
    params 的内容会带在 url 后面,作为 query string, 比如 https://www.baidu.com?xxx=yyy&aaa=bbb
    misaka19000
    misaka19000
    Jul 30, 2018
    6
    能用搜索引擎搜索到的问题为什么要提个问题呢?

    https://stackoverflow.com/a/24535938/4614538
    pcdRob
    pcdRob
    Jul 30, 2018
    7
    @hicdn params 是往 url 后面添加参数。
    5oiR5piv5YK76YC8
    5oiR5piv5YK76YC8
    Jul 30, 2018
    8
    param: url 参数
    data: 表单
    json: json
    都传字典进去
    RyougiShiki
    RyougiShiki
    Jul 30, 2018
    9
    params 是 url ?后那种; data 是 form 表单、file 类,在请求的 body 中。
    hicdn
    hicdn
    Jul 30, 2018
    10
    @pcdRob 多谢指正。

    @bestehen 你的问题 @Marmot 说的很清楚。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   495 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 21:24 · PVG 05:24 · LAX 13:24 · JFK 16:24
    ♥ Do have faith in what you're doing.