python提取url中的域名和端口号 2015/06/15 13220 python提取url中的域名和端口号 import urllib proto, rest = urllib.splittype("http://www.open-open.com/") host, rest = urllib.splithost(rest) print host host, port = urllib.splitport(host) if port is None: port = 80 print port