check.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:autoreg 作者: pbeyssac 项目源码 文件源码
def checkip(ip):
  """Check IPv4/IPv6 address for validity"""
  try:
    if ':' in ip:
      socket.inet_pton(socket.AF_INET6, ip)
    else:
      socket.inet_pton(socket.AF_INET, ip)
  except socket.error:
    return False
  return True

#
# Regexp for a valid FQDN:
#  - only letters, digits, '-'
#  - no '-' at the beginning or end of a label
#  - at least one '.'
#  - no '.' at the beginning or end
#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号