【发布时间】:2020-08-31 16:40:25
【问题描述】:
我有兴趣创建一个函数,如果字符串包含使用 python 的 IP 地址,它将返回 true。
def having_IP_Adress(URL):
URL.match('^(http|https)://\d+\.\d+\.\d+\.\d+\.*')
print (having_IP_Adress("http://197.248.5.23/"))
但它给了我一个错误
【问题讨论】:
-
请同时发布错误信息。在解释和指导您找到固定解决方案时会有所帮助????
-
请从intro tour 重复on topic 和how to ask。我们希望您在此处发布之前研究该主题。有许多已发布的解决方案(取决于您需要的准确度)来检测有效 IP 地址。对于错误消息,我们需要预期的minimal, reproducible example。