Python web爬虫

Python 爬虫下程序

# coding:UTF-8
import urllib
 
#' 获取web页面内容并返回'
def getWebPageContent(url):
    f = urllib.urlopen(url)
    data = f.read()
    f.close()
    return data
 
url = 'http://www.baidu.com'
content = getWebPageContent(url)
print content
 

你可能感兴趣的:(Web,python,爬虫,content,休闲)