python
来源:互联网 发布:centos 7.2安装选项 编辑:程序博客网 时间:2024/06/09 19:32
infolite
demo
# coding: utf-8# ## pyquery 抓取腾讯新闻# In[7]:import requestsfrom pyquery import PyQuery as pqhtml = requests.get('http://news.qq.com/').textnews_items = pq(html).find('.linkto').items()news_arr = []for news in news_items: news_arr.append({'title' : news.text(), 'url' : news.attr('href')})news_arr[0]# In[14]:import pandasimport datetimenews_df = pandas.DataFrame(news_arr)news_df.to_excel('{}.xlsx'.format(datetime.date.today().strftime('%Y-%m-%d')))
阅读全文
0 0
- Python
- Python
- Python
- python
- Python
- PYTHON
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- python
- Python
- 常见浏览器的兼容问题
- 有关c#通过串口接收机器数据的分析
- Android Api demo系列(18) (Graphics>AlphaBitmap)
- Ruby 代码块及其作用域详解
- 动态规划总结
- python
- 操作系统常见面试和笔试题
- java ssl通信
- CSS的四种引入方式
- Lambda表达式
- 202. Happy Number
- C++常用
- mac终端命令学习
- 我们正在路上—从持续集成到持续发布