File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed
Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change 1- # file handling
2- #fname = input("Enter file name: ")
3- #if len(fname) < 1 : fname = "wardrobe.ini"
1+ # input file handling
42fname = "wardrobe.ini"
53try :
6- fhand = open (fname )
4+ inHand = open (fname , 'r' )
75except :
86 print ('File cannot be opened:' , fname )
97 exit ()
108
9+ # output file handling
10+ outputName = "UB_ped_xml.txt"
11+ try :
12+ outHand = open (outputName , 'w' )
13+ except :
14+ print ('File cannot be opened:' , outputName )
15+ exit ()
16+
1117#vars
1218wardrobeName = ""
1319wardrobeDict = dict ()
3238}
3339
3440# consume wardrobe.ini
35- for line in fhand :
41+ for line in inHand :
3642 line = line .rstrip ()
3743 if line .startswith ("[" ) : #find start of individual wardrobe and save/print name
3844 wardrobeName = line .strip ('[]' )
6369#use dict.get to pull xref and create output
6470#loop through data structure and output
6571for wardrobe in allWardrobes :
66- print (wardrobe )
72+ #print(wardrobe)
73+ outHand .write (wardrobe + "\n " )
6774 #print(allWardrobes[wardrobe])
6875 output = "<Ped"
6976 for comp in allWardrobes [wardrobe ] :
8895
8996 #print(allWardrobes[wardrobe][comp])
9097
91- output += ">{}</Ped>" .format (pedName )
92- print (output , "\n " )
98+ output += ">{}</Ped>\n \n " .format (pedName )
99+ #print(output)
100+ outHand .write (output )
101+
102+ inHand .close ()
103+ outHand .close ()
You can’t perform that action at this time.
0 commit comments