多语言展示
当前在线:1466今日阅读:26今日分享:39

如何用python写爬虫

python写爬虫很简单;给你个简单的例子:这里def 是用来定义函数用的,urllib.urlopen 是获取链接内容的方法;然后你还要通过正则匹配来获取在这个页面你所需要的东西;就这么简单!def getHtml(url):    page = urllib.urlopen(url)    html = page.read()    return html html = getHtml("http://tieba.baidu.com/p/2738151262")print html
推荐信息