py2
import urlparse
result = urlparse.urlparse(url)
host = result.hostname
py3
from urllib.parse import urlparse
result = urlparse(url)
host = result.hostname
其他地方的有点坑,自己做个记录。
py2
import urlparse
result = urlparse.urlparse(url)
host = result.hostname
py3
from urllib.parse import urlparse
result = urlparse(url)
host = result.hostname
其他地方的有点坑,自己做个记录。