Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75327 > unrolled thread
| Started by | Edward Manning <ejmmanning@gmail.com> |
|---|---|
| First post | 2014-07-28 17:33 -0400 |
| Last post | 2014-07-28 17:33 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
gethostbyaddr() Edward Manning <ejmmanning@gmail.com> - 2014-07-28 17:33 -0400
| From | Edward Manning <ejmmanning@gmail.com> |
|---|---|
| Date | 2014-07-28 17:33 -0400 |
| Subject | gethostbyaddr() |
| Message-ID | <mailman.12399.1406583208.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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="")
Back to top | Article view | comp.lang.python
csiph-web