Python中文
首页
教程
问答
标签
搜索
登录
注册
如何使用xmlfeedspid获取xml提要
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我正在尝试使用以下格式获取一个xml文件</p> <p><strong>文件_示例.xml:</strong></p> <pre><code><rss version="2.0"> <channel> <item> <title>SENIOR BUDGET ANALYST (new)</title> <link>https://hr.example.org/psp/hrapp&SeqId=1</link> <pubDate>Wed, 18 Jul 2012 04:00:00 GMT</pubDate> <category>All Open Jobs</category> </item> <item> <title>BUDGET ANALYST (healthcare)</title> <link>https://hr.example.org/psp/hrapp&SeqId=2</link> <pubDate>Wed, 18 Jul 2012 04:00:00 GMT</pubDate> <category>All category</category> </item> </channel> </rss> </code></pre> <p>以下是我的<strong>蜘蛛网.py</strong>代码</p> ^{pr2}$ <p><strong>结果:</strong></p> <pre><code>2012-07-25 13:24:14+0530 [testproject] DEBUG: Scraped from <200 https://hr.templehealth.org/hrapp/rss/careers_jo_rss.xml> {'title': [u'SENIOR BUDGET ANALYST (hospital/healthcare)', u'BUDGET ANALYST'], 'link': [u'https://hr.example.org/psp/hrapp&SeqId=1', u'https://hr.example.org/psp/hrapp&SeqId=2'] 'pubdate': [u'Wed, 18 Jul 2012 04:00:00 GMT', u'Wed, 18 Jul 2012 04:00:00 GMT'] 'category': [u'All Open Jobs', u'All category'] } </code></pre> <p>从上面的结果可以看出,所有来自相应标记的结果都被组合到一个列表中,但是我想根据它们的单个项标记进行映射,如下所示,就像我们为html抓取所做的那样。在</p> <pre><code> {'title': u'SENIOR BUDGET ANALYST (hospital/healthcare)' 'link': u'https://hr.example.org/psp/hrapp&SeqId=1' 'pubdate': u'Wed, 18 Jul 2012 04:00:00 GMT' 'category': u'All Open Jobs' } {'title': u'BUDGET ANALYST' 'link': u'https://hr.example.org/psp/hrapp&SeqId=2' 'pubdate': u'Wed, 18 Jul 2012 04:00:00 GMT' 'category': u'All category' } </code></pre> <p>我们如何根据单独的主标记(如上面的item标记)来获取xml标记数据。在</p> <p>提前谢谢。。。。。。。。。。。。。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我建议使用<a href="http://packages.python.org/feedparser/" rel="nofollow">feedparser</a>:</p> <pre><code>feedparser.parse(url) </code></pre> <p>结果</p> ^{pr2}$
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
8 回答
无法使用Django\u mssql\u后端迁移到外部hos
6 回答
无法使用Django&Python3.4连接到MySql
9 回答
无法使用Django+nginx上载媒体文件
10 回答
无法使用Django1.6导入名称模式
10 回答
无法使用Django1.7和mongodb登录管理站点
8 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
8 回答
无法使用Djangockedi验证CBV中的字段
6 回答
无法使用Djangocketditor上载图像(错误400)
6 回答
无法使用Djangocron进行函数调用
5 回答
无法使用Djangofiler djang上载文件
5 回答
无法使用Djangokronos
10 回答
无法使用Djangomssql provid
8 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
7 回答
无法使用Djangomssq迁移Django数据库
5 回答
无法使用Djangonox创建用户
6 回答
无法使用Djangopyodb从Django查询SQL Server
10 回答
无法使用Djangopython3ldap连接到ldap
5 回答
无法使用Djangoredis连接到redis
4 回答
无法使用Django中的FK创建新表
9 回答