#!/usr/bin/python3 # -*- coding: utf-8 -*- import re ip = "192.168.1.1" ip = re.findall("^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$", ip) print(ip) if not ip: print("no") else: print("yes")
原文地址:https://www.cnblogs.com/37yan/p/10303724.html
时间: 2024-10-10 16:05:56