手机
当前位置:查字典教程网 >脚本专栏 >python >python抓取百度首页的方法
python抓取百度首页的方法
摘要:本文实例讲述了python抓取百度首页的方法。分享给大家供大家参考。具体实现方法如下:importurllibdefdownURL(url,...

本文实例讲述了python抓取百度首页的方法。分享给大家供大家参考。具体实现方法如下:

import urllib def downURL(url,filename): try: fp=urllib.urlopen(url) except: print('download error') return 0 op=open(filename,'wb') while 1: s=fp.read() if not s: break op.write(s) fp.close() op.close() return 1 downURL("http://www.baidu.com","C:url.txt")

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

【python抓取百度首页的方法】相关文章:

python脚本实现查找webshell的方法

c++生成dll使用python调用dll的方法

python和shell变量互相传递的几种方法

python生成指定长度的随机数密码

python 获取et和excel的版本号

python调用shell的方法

python赋值操作方法分享

vc6编写python扩展的方法分享

Python中文件遍历的两种方法

Python学习笔记_数据排序方法

精品推荐
分类导航