0
How to check the validity of an IP address and classify them (python)
3 Réponses
+ 3
I made a code for you
https://code.sololearn.com/c8z0WqQ9b3yY/?ref=app
+ 2
# Python program to validate an Ip address
#By Galaxy-Coding
import re
regex = '''^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)#x27;''
def check(Ip):
if(re.search(regex, Ip)):
print("Valid Ip address")
else:
print("Invalid Ip address")
if __name__ == '__main__' :
Ip = input()
check(Ip)
0
thanks a lot😀