Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75327
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ejmmanning@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.044 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.00; 'socket': 0.07; 'subject:()': 0.09; 'def': 0.12; 'wrote': 0.14; '"r")': 0.16; '"w")': 0.16; 'main():': 0.16; 'code,': 0.22; 'input': 0.22; 'import': 0.22; 'why.': 0.24; 'fine': 0.24; 'file.': 0.24; 'idea': 0.28; 'anyone': 0.31; 'file': 0.32; 'open': 0.33; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'charset:us- ascii': 0.36; 'should': 0.36; 'error.': 0.37; 'message- id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'header:Message-Id:1': 0.63; 'our': 0.64; 'more': 0.64; 'results': 0.69; 'subject:skip:g 10': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:message-id:date:to:mime-version; bh=U2Q2eMJrpUP78Z6FcDuaXmtG0sq0IRzFAuKBEER1Qm0=; b=jOhXEOr5wQGUdwoJ7n+1+PXjZd7vhqGoStOSCFlf2yUmSlXeXC9WM2nA0qIVu+tZS1 tdH4Wf7tft9XMCz9iX3oxN22FA41WI88NVwlA396gXnbsKq2RXrjAQWxXZOlMIAv61KN K1l8wtSgLbV7hVBrVU7Spyy8V4msykAyJnByPiAnG4W6G50oz1/eHUc/w9S4homVGZiy fB0ZLfyx8yf2Ts9eUXv9HXhjJaJUeUcBMWSPiqsDHQCMQux6o3tC7E1oqLyK6sdpSuYE vHeaokDp7LNnPzanUhBa+N+AjQLZqecbCU5aw44C2xM2UJcrp8NnvQqGHGzGQdSBThP9 Yh8w== |
| X-Received | by 10.224.89.10 with SMTP id c10mr65389884qam.51.1406583206127; Mon, 28 Jul 2014 14:33:26 -0700 (PDT) |
| From | Edward Manning <ejmmanning@gmail.com> |
| Content-Type | multipart/alternative; boundary="Apple-Mail=_00A54C0E-954D-4652-A5B6-5E534D7852F7" |
| Subject | gethostbyaddr() |
| Date | Mon, 28 Jul 2014 17:33:23 -0400 |
| To | python-list@python.org |
| Mime-Version | 1.0 (Mac OS X Mail 8.0 \(1971.5\)) |
| X-Mailer | Apple Mail (2.1971.5) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12399.1406583208.18130.python-list@python.org> (permalink) |
| Lines | 102 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1406583208 news.xs4all.nl 2941 [2001:888:2000:d::a6]:36874 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:75327 |
Show key headers only | View raw
[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 comp.lang.python | Previous | Next | Find similar | Unroll thread
gethostbyaddr() Edward Manning <ejmmanning@gmail.com> - 2014-07-28 17:33 -0400
csiph-web