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本文共 266 字,大约阅读时间需要 1 分钟。
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转载于:https://blog.51cto.com/ygongzi/828839