Chinaunix首页 | 论坛 | 博客
  • 博客访问: 907866
  • 博文数量: 75
  • 博客积分: 1216
  • 博客等级: 少尉
  • 技术积分: 1998
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-11 16:20
个人简介

优秀是一种习惯

文章分类

全部博文(75)

文章存档

2014年(1)

2013年(29)

2012年(45)

分类: Python/Ruby

2012-12-16 17:54:42

#!/usr/bin/python
import sys,socket

def print_array(*arr):
        array = arr
        for item in array:
                print item[4][0]

print '''this script is for host resolve
print "now this begin...
if you want to leave,please input "break"'''

while 1:
        try:
                host = raw_input("please input the host: ")
        except KeyboardInterrupt:
                print "\n",
                continue
        except :
                print "\n",
                continue

        if host == "break" or host == "":
                break
        result = socket.getaddrinfo(host,None,0,socket.SOCK_STREAM)
        print_array(*result)
阅读(2696) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~