1
from xml.dom.minidom import parseString, parse
dom = parse('response.xml')
xmlTag = dom.getElementsByTagName('link')[0].toxml()
如何获取XML的相对= “候补” 的属性 'href' 属性:在Python,检索XML属性值
<link rel='alternate' type='text/html' href='http://www.youtube.com/watch?v=gfyKPbic&feature=youtube_gdata'/>
<link rel='http://gdata.youtube.com/schemas/2007#video.responses' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/gf7zhyKPbic/responses'/>
在其他错误,该行'DOM = parseString(data)dom = parse('response.xml')'是无效的Python语法。 – MattH