-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtfile_generated.py
More file actions
22 lines (19 loc) · 1.04 KB
/
tfile_generated.py
File metadata and controls
22 lines (19 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import csv
csv_file = 'VROMISSILES.csv'
xml_data_final = ''
csv_data = csv.DictReader(open(csv_file), fieldnames=['name', 'macro', 'tags', 'info', 'race', 'damage', 'reload', 'amount', 'barrel', 'dps', 'alpha', 'lifetime', 'thrust', 'speed', 'travel', 'firerange', 'guided', 'retarget', 'swarm', 'locktime', 'lockrange', 'hull', 'weapon', 'resiliense', 'mass', 'inertia', 'dforward', 'dhv', 'dman', 'explosioneffect', 'launcheffect', 'engine', 'component', 'price', 'cells', 'mcs', 'sc', 'prodtime', 'tname', 'tbasename', 'tdescription'])
row_n = 0
for row in csv_data:
if row_n == 0:
print('row' + str(row_n) + ' is not printing')
row_n += 1
else:
xml_data = '<t id="%s">%s</t>\n<t id="%s">%s</t>\n<t id="%s">%s</t>\n' % (row['tname'], row['name'], row['tbasename'], row['name'], row['tdescription'], row['name'])
xml_data_final += xml_data
print(xml_data)
row_n += 1
print(xml_data_final)
xml_file = 'tfile_generated.xml'
F = open(xml_file, 'w')
F.write(xml_data_final)
F.close