Python解析xml以从d检索“标题”

2024-05-14 19:17:39 发布

您现在位置:Python中文网/ 问答频道 /正文

然后用一个python'm的方式解析出一个带有标题的变量。在

显示/读取的URL数据示例:

<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" debug="true">
    <script id="FirebugLite" firebugIgnore="true" extension="Chrome"/>
    <song id="11450" parent="11042" title="30 Minutes Or Less (2011)" album="30 Minutes Or Less (2011)" isDir="false" created="2011-11-04T16:07:38" duration="4983" bitRate="1536" size="3521040154" suffix="mkv" contentType="video/x-matroska" isVideo="true" path="30 Minutes Or Less (2011)/30 Minutes Or Less (2011).mkv" transcodedSuffix="flv" transcodedContentType="video/x-flv"/>
</subsonic-response>

有没有办法从标题字段中获取数据?所以在一个变量中,我会以“30分钟或更少(2011)”结束

我现在已经有了流动的代码,但是在让它工作时遇到了困难。在

^{pr2}$

错误: TypeError:必须使用ElementTree实例作为第一个参数调用未绑定方法parse()(改为获取str实例)


Tags: or数据实例idtrueurl标题response

热门问题