0
A program that reads a text file containing a list of IP addresses and store invalid IP addresses in an array.
Input file:
200.135.80.9
192.168.1.1
8.35.67.74
257.32.4.5
85.345.1.2
1.2.3.4
9.8.234.5
192.168.0.256
Exit:
["257.32.4.5", "85.345.1.2", "9.8.234.5", "192.168.0.256"]
My code:
ip = open('endereços.txt','r')
line = []
line = ip.read().split('\n')
#Estrutura incompleta
if 0 > ip[0] > 255:
print(ip[0])
in the case , were those as output
– Elaynne Vieira
Do you have any idea what that exit would be like?
– Elaynne Vieira
cool, you can use the import socket and call the function to check ... socket.inet_aton(ip.replace("n",')) and treat using Exception , inside the Try the list of valid ip and except those that are not variable.
– stack.cardoso
All right, I’ll try !
– Elaynne Vieira