首页
学习
活动
专区
圈层
工具
发布
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    python3爬虫urllib

    请求参数反序列化转回字典; urllib.parse.parse_qsl():将参数转化为元组组成的列表; urllib.parse.urlparse():对 URL 进行分段(返回6个结果); urllib.parse.urlunparse...ParseResult 类型的对象,含 scheme、netloc、path、params、query 和 fragment 6 个部分,依次代表协议、域名、路径、参数、查询条件、锚点 urllib.parse.urlunparse...() 与 urlparse() 相反,对 URL 进行组合,传入的参数是一个可迭代对象,长度必须是 6,否则会抛出参数数量不足或者过多的问题,示例: from urllib.parse import urlunparse...data = ['http', 'www.baidu.com', 'index.html', 'user', 'a=6', 'comment'] print(urlunparse(data))...www.baidu.com', path='/index.html;user', query='id=5', fragment='comment') urllib.parse.urlunsplit() 与 urlunparse

    1.4K30
    领券