I wrote this code, but it seem to work fine if I only have one ip in the file.
When I have more than one IP in the file
I get a error. Does anyone have an idea why.
import socket
def main():
# get file names
infileName = input ("What file our the IP adderss in? ")
outfileName = input("What file should the results go in?")
# open files
infile = open(infileName, "r")
outfile = open(outfileName, "w")
#Proccess each line of the input file
for line in infile:
ipAddress = line.strip()
resluts = socket.gethostbyaddr(ipAddress)
print(resluts[0],resluts[2], end="")
--
https://mail.python.org/mailman/listinfo/python-list