码迷,mamicode.com
首页 > 编程语言 > 详细

[python]deteval中groundtruth.xml内容重新排序

时间:2014-05-07 11:01:12      阅读:602      评论:0      收藏:0      [点我收藏+]

标签:des   blog   ext   int   get   strong   

#xml api:http://www.cnblogs.com/lhj588/archive/2011/11/09/2242483.html

#dictionary operations: key in dict....

from xml.dom import minidom, Node
doc = minidom.parse(‘out.xml‘)
tagset=doc.firstChild
image=tagset.firstChild
images={}
while image:
# print image.toxml()
# props=dir(image)
# print type(image)
# print type(image)
if hasattr(image,"tagName"):
# print image.tagName+":"
# print str(eval("image.%s"%"tagName"))
for imagetag in image.childNodes:

imagename=image.getElementsByTagName("imagename")[0].childNodes[0].nodeValue
images[imagename]=image

# if hasattr(imagetag,"tagName"):
# if imagetag.tagName=="imagename":
# print imagetag.toxml()

image=image.nextSibling

# for i in images.keys():
# print i

print "<tagset>"
for i in range(1,419):
imagename=str(i)+".jpg"
if images.has_key(imagename):
print imagename+"formatted"
print images[imagename].toxml()
print "</tagset>"

[python]deteval中groundtruth.xml内容重新排序,布布扣,bubuko.com

[python]deteval中groundtruth.xml内容重新排序

标签:des   blog   ext   int   get   strong   

原文地址:http://www.cnblogs.com/bigboy/p/3712947.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!