python抓取网页内容示例分享
复制代码 代码如下:import socketdef open_tcp_socket(remotehost,servicename): s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) portnumber=socket.getservbyname(servicename,’tcp’) s.connect((remotehost,portnumber)) return smysocket=open_tcp_socket(‘www.taobao.com’,’http’)mysocket.send(‘hello’)whil
用户评论