python3抓取中文网页的方法
python3抓取中文网页的方法
发布时间:2016-12-28 来源:查字典编辑
摘要:本文实例讲述了python3抓取中文网页的方法。分享给大家供大家参考。具体如下:#!/usr/bin/python3.2importsysi...

本文实例讲述了python3抓取中文网页的方法。分享给大家供大家参考。具体如下:

#! /usr/bin/python3.2 import sys import urllib.request req = urllib.request.Request('http://www.baidu.com') response = urllib.request.urlopen(req) the_page = response.read() type = sys.getfilesystemencoding() #转换成本地系统编码 print(the_page.decode(type))

希望本文所述对大家的Python程序设计有所帮助。

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新python学习
热门python学习
脚本专栏子分类