37,719
社区成员
发帖
与我相关
我的任务
分享
import socket
httpSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
httpSock.connect(("google", 80)) # here
httpSock.send("GET /\n")
data = httpSock.recv(1024)
httpSock.close()
if not data:
f = open("get.html", 'w')
f.write(data)
f.close()
print data.strip()
else:
print "receive nothing"