Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

all option in python

ip = "1.1.1.1"
w = ip.split(".")
print(w[0])
l2 = []
for i in w:
    print(type(i))
    print(i)
    if  (w[0] != 0) and (int(i) > 0) and (int(i) <= 255):
       l2.append(1)
       
    else:
       l2.append(0)
print(l2)   
if all(l2):
   print("valid ip address")
else:
   print("invalid ip address")
Source by www.edureka.co #
 
PREVIOUS NEXT
Tagged: #option #python
ADD COMMENT
Topic
Name
1+1 =