#判断IP是否合法 def check_ip(s): for i in s: #每一位必须在0-255,否则IP非法 if int(i) < 0 or int(i) > 255: return False return True #判断子网掩码是否合法 def check_mask(...