Perl Hacker, Python Initiate
alain at dpt-info.u-strasbg.fr
Wed Feb 2 11:24:13 CET 2011
Gary Chambers <gwchamb at gwcmail.com> writes:
> Given the following Perl script:
[41 lines of Perl removed]
Sorry, I'm lucky enough to be able to completely ignore Perl.
> Will someone please provide some insight on how to accomplish that task in
>From what I understood in the comments of your script, here is a possible
canon,aliases,ipaddrs = socket.gethostbyname_ex(sys.argv)
See also getaddrinfo(). Note that a canonical name may have several ip
addresses (try with www.google.com if you doubt).
(BTW, this is a direct interface to gethostbyname(), and there is no
real need to use a tool and parse its output.)
> I am unable to continually (i.e. it stops after displaying a single
> line) loop through the output while testing for the matches on the two
> regular expressions. Thank you.
It is hard to guess what you've tried. See the subprocess package
More information about the Python-list