dir_to_xml.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import sys, os
00004 #, os, time
00005 
00006 
00007 def to_xml(file, path):
00008     f = open(file, 'w')
00009     if path == None:
00010         path = '.'
00011     list = os.listdir(path)
00012     f.write('<?xml version="1.0" ?><imgdataset>')
00013     for file in list:
00014         if file[-4:] == '.png':
00015             angle = file.split('_')[1]
00016             f.write('<category>\n')
00017             f.write('\t<title>' + angle + '</title>' + ' <filename>' + './' + path + '/' + file + '</filename>\n')
00018             f.write('</category>\n')
00019     f.write('</imgdataset>')
00020     f.close
00021 
00022 
00023 
00024 
00025 
00026         
00027 if __name__ == "__main__":
00028     if sys.argv.__len__() <= 1:
00029         print 'Provide arguments'
00030         exit(0)
00031     elif sys.argv[1] == '-toxml':
00032         to_xml(sys.argv[2], sys.argv[3])


player_log_actarray
Author(s): Radu Bogdan Rusu
autogenerated on Mon Oct 6 2014 09:38:35