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
原文地址:https://www.cnblogs.com/andy9468/p/8322323.html
时间: 2024-10-05 08:10:13