[Tutor] Want to write a Perl based IP to Domain Name converter.
wescpy at gmail.com
Sat Jan 31 23:42:50 CET 2009
>> >> The script in the following can do the batch conversion from domain
>> >> name to IP:
>> > This is a Python list, not Perl!
>> OMG! It's my mistake, sorry for this.
> Lol..thats okay. Now that you are here and have seen what fun we have
> writing Python code - why not join the party?
> Don't be shy to join us :p - i bet you won't be sorry.
well, he had to join Tutor to post, unless a mod allowed his msg, so
there should be *some* interest in doing it in Python. after all, the
equivalent code is already slightly shorter and easier to read than
the Perl version...
for hp in sys.argv[1:]:
h, p = hp.strip().split(':')
print '%s -> %s:%s' % (hp, socket.gethostbyname(h), p)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
More information about the Tutor