python创建迅雷批量任务
2016-02-12 01:01
603 查看
其实不是真的创建了批量任务,而是用python创建一个文本文件,每行一个要下载的链接,然后打开迅雷,复制文本文件的内容,迅雷监测到剪切板变化,弹出下载全部链接的对话框~~
实际情况是这样的,因为用python分析网页非常,比如下载某页中的全部pdf链接
实际情况是这样的,因为用python分析网页非常,比如下载某页中的全部pdf链接
from __future__ import unicode_literals from bs4 import BeautifulSoup import requests import codecs r = requests.get('you url') s = BeautifulSoup(r.text) links = s.findall('a') pdfs = [] for link in links: href = link.get('href') if href.endswith('.pdf'): pdfs.append(href) with open('you file', 'w', 'gb2312') as f: for pdf in pdfs: f.write(pdf + '\r\n')
相关文章推荐
- Python模块之SciPy
- Python模块之NumPy
- python黑魔法之参数传递
- 常用python编程模板汇总
- 一步步解析Python斗牛游戏的概率
- 理解Python垃圾回收机制
- 教大家使用Python SqlAlchemy
- wxpython怎么识别用户的点击来自哪个按钮
- 基于 Python django 的小型论坛系统
- Python图像处理库PIL的基本模块介绍
- python select、poll
- python socketserver
- python socket
- Python - Package os
- python3获取天气预报(转)
- Python+selenium的GUI自动化实现
- python logging模块详解[转]
- python编程常用模板总结
- Python中使用正则表达式
- Windows7基于Python3.5安装Ipython notebook(现称jupyter)