本站改版新增arduino频道
micropython 根据网址链接HTTP协议判断使用端口
def geturlport(url): try: proto, dummy, host, path = url.split("/", 3) except ValueError: proto, dummy, host = url.split("/", 2) path = "" if proto == "http:": port = 80 elif proto == "https:": import ussl port = 443 else: raise ValueError("Unsupported protocol: " + proto) return port
如:
http://www.xxx.cn/
https://www.4936.cn/
结果:
80
443
Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.010241031646729 seconds