首页 > 代码库 > Python网页抓取2

Python网页抓取2

#!coding:utf-8
# 获取web页面
import
sys,urllib2req=urllib2.Request(sys.argv[1])fd=urllib2.urlopen(req)while 1: data=fd.read() if not len(data): break print data
#coding:utf-8import sys,urllib2req=urllib2.Request(sys.argv[1])fd=urllib2.urlopen(req)print "url:",fd.geturl()print "info:",fd.info()

 

Python网页抓取2