>>> re.match(r'^(([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$',"192.168.1.1").group()
'192.168.1.1'本文共 191 字,大约阅读时间需要 1 分钟。
>>> re.match(r'^(([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$',"192.168.1.1").group()
'192.168.1.1'转载于:https://www.cnblogs.com/xiaxiaoxu/p/9302197.html