Home > Backend Development > Python Tutorial > python实现对一个完整url进行分割的方法

python实现对一个完整url进行分割的方法

WBOY
Release: 2016-06-06 11:15:03
Original
2523 people have browsed it

本文实例讲述了python实现对一个完整url进行分割的方法。分享给大家供大家参考。具体分析如下:

python对一个完整的url进行分割,将url分割成单独的部分,包括协议、域名、端口、路径、参数等等

import urlparse
print urlparse.urlsplit('http://www.bitsCN.com:80/faq.cgi?src=fie')
Copy after login

结果如下:

代码如下:

SplitResult(scheme='http', netloc='www.bitsCN.com:80', path='/faq.cgi', query='src=fie', fragment='')

希望本文所述对大家的Python程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template