编辑器
from urllib.parse import urlparse url = 'https://www.example.com/path?query=value' parsed = urlparse(url) print(f'Scheme: {parsed.scheme}') print(f'Netloc: {parsed.netloc}') print(f'Path: {parsed.path}')
Scheme: https
Netloc: www.example.com
Path: /path