需求:提取URL中的域名及传输协议等

使用python内置模块 urllib

from urllib.parse import urlparse

url = 'https://www.lubaogui.com/1126/'
res = urlparse(url)
print(res)

# ParseResult(scheme='https', netloc='www.lubaogui.com', path='/1126', # params='', query='', fragment='')