#!/usr/bin/python # coding:utf-8 import re import urlparse # 解析url def ParseUrl(url): if not re.search(r"^http[s]?://",url): if ":443" in url: url = "https://" + url else: url = "http://" + url return url