获取域名的代码如下:
import sys import re import urllib pattern = re.compile(r"(http|https)://(www\.|)(.*?)(/|$|\?|:)") def get_domain(s): for match in pattern.finditer(s): return match.group(3) return None
获取域名的代码如下:
import sys import re import urllib pattern = re.compile(r"(http|https)://(www\.|)(.*?)(/|$|\?|:)") def get_domain(s): for match in pattern.finditer(s): return match.group(3) return None