Python骚操作知识点总结(持续更新)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29027865/article/details/83589460

1.urlencode

urlencode的参数是词典,它可以将key-value这样的键值对转换成我们想要的格式。python2中:urlencode在urllib.urlencode
python3中:urlencode在urllib.parse.urlencode

params = {
        "q": "mac",
        "perPageSize": 1
  }
query_str = urllib.parse.urlencode(params)
#输出的结果为
q=mac&perPageSize=1

猜你喜欢

转载自blog.csdn.net/qq_29027865/article/details/83589460
今日推荐