url解析
提取域名domain
from urllib.parse import urlparse url=‘http://www.freebuf.com/articles/437.html‘ url_parse = urlparse(url) print(url_parse) print(url_parse.netloc)
输出:
ParseResult(scheme=‘http‘, netloc=‘www.freebuf.com‘, path=‘/articles/437.html‘, params=‘‘, query=‘‘, fragment=‘‘)
www.freebuf.com