Python处理RSS、ATOM模块FEEDPARSER介绍

yipeiwu_com6年前Python基础

由于Google reader的关闭,这段时间接触rss的东西相对多很多。试过qq的reader,不怎么样,阅读速度没有,是否阅读的标记也没有。其他网站的不想用,又要多注册账户。

找到python的rss处理包feedparser,官方文档很详细。http://pythonhosted.org/feedparser/

复制代码 代码如下:

>>> import feedparser
>>> d = feedparser.parse(‘http://0x55aa.sinaapp.com/feed')
>>> a = d.feed
>>> a.title

可以使用keys来查看字典键,可以很清楚的弄懂每一个的意思。官方文档上每一个都有介绍。
复制代码 代码如下:

>>> d['feed'].keys()

rss订阅的文章在d.entries里面是一个列表。

详细使用和高级用法见feedparser官方文档。

相关文章

python字符串加密解密的三种方法分享(base64 win32com)

1. 最简单的方法是用base64: 复制代码 代码如下:import base64 s1 = base64.encodestring('hello world')s2 = base64...

python requests 使用快速入门

快速上手 迫不及待了吗?本页内容为如何入门 Requests 提供了很好的指引。其假设你已经安装了 Requests。如果还没有,去安装一节看看吧。 首先,确认一下: Requests...

Python分割指定页数的pdf文件方法

如下所示: from PyPDF2 import PdfFileWriter, PdfFileReader # 开始页 start_page = 0 # 截止页 end_page...

将tensorflow的ckpt模型存储为npy的实例

实例如下所示: #coding=gbk import numpy as np import tensorflow as tf from tensorflow.python impor...

numpy向空的二维数组中添加元素的方法

直接上代码了 x = np.empty(shape=[0, 4], int) x = np.append(x, [[1,2,3,4]], axis = 0) x = np.appen...