Guest User

Untitled

a guest
Jan 23rd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. def judge_legal_ip(ip):
  2. """判断一个IP地址是否合法"""
  3. compile_ip = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$')
  4. if compile_ip.match(ip):
  5. return True
  6. else:
  7. return False
Add Comment
Please, Sign In to add comment