Python3 urllib.parse
来源:互联网 发布:软件小站的解压密码 编辑:程序博客网 时间:2024/05/16 19:54
urllib.parse分为URL parsing and URL quoting,即网址解析和网址引用。
URL解析函数专注于将URL字符串拆分为其组件,或将URL组件组合到URL字符串中。
urllib.parse.
urlparse
(urlstring,scheme='', allow_fragments=True)>>> from urllib.parse import urlparse>>> o = urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')>>> o ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html', params='', query='', fragment='')>>> o.scheme'http'>>> o.port80>>> o.geturl()'http://www.cwi.nl:80/%7Eguido/Python.html'
>>> from urllib.parse import urlparse>>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html', params='', query='', fragment='')>>> urlparse('www.cwi.nl/%7Eguido/Python.html')ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html', params='', query='', fragment='')>>> urlparse('help/Python.html')ParseResult(scheme='', netloc='', path='help/Python.html', params='', query='', fragment='')
urllib.parse.
urlsplit
(urlstring,scheme='', allow_fragments=True)使用方法同上
合并URL
urll.parse.urlencode()
urllib.parse.
urlunsplit
(parts)
urllib.parse.
urljoin
(base,url, allow_fragments=True)>>> from urllib.parse import urljoin>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', 'FAQ.html')'http://www.cwi.nl/%7Eguido/FAQ.html'
0 0
- Python3 urllib.parse
- Python3的urllib.parse常用函数小结
- python3 urllib.parse.urljoin()用法
- Python3模块详解--老司机工具urllib模块详解之urllib.parse子模块
- urllib的parse模块
- 爬虫入门1:urllib.parse
- python3 urllib.request
- Python3.3中的urllib
- Python3 的urllib实例
- Python3.x urllib
- python3 urllib函数
- Python3 urllib 笔记
- python3 urllib post json
- python3 标准库 urllib
- Python3 之 urllib
- urllib python3 翻译
- Python3 Urllib学习
- Python3 urllib 笔记
- 关于java使用Ftpclient上传到FTP服务器文件损坏的问题解决
- leetcode 4. Median of Two Sorted Arrays
- 不敢死队问题 (sdut oj)
- CI1.1 实现一个算法,确定一个字符串的所有字符是否全部不同。假使不允许使用额外的数据结构。
- Linux监控JVM常用命令解析
- Python3 urllib.parse
- 城市三级联动 评论:发送信息清空输入框
- java字符串字面量是否生成String对象
- 用xshell安装jdk
- iOS scrollview不能滑动的几个原因及解决方法
- hdu2084数塔
- GDUT1169:Krito的讨伐(树 + 优先队列)
- JAVA四则运算字符串解释器
- 列表标签:无序列表、有序列表、定义列表