面试题答案
一键面试import re
url = 'https://www.example.com/path/to/page?query=value'
match = re.search(r'https?://([^/]+)', url)
if match:
domain = match.group(1)
print(domain)
import re
url = 'https://www.example.com/path/to/page?query=value'
match = re.search(r'https?://([^/]+)', url)
if match:
domain = match.group(1)
print(domain)