Browse Source

refactored script with polished starting xml

andreagus 8 years ago
parent
commit
274d321f8b
2 changed files with 5 additions and 9 deletions
  1. 5 9
      converter.py
  2. 0 0
      data.xml

+ 5 - 9
converter.py

@@ -3,16 +3,12 @@ import csv
 tree = ET.parse('data.xml')
 root = tree.getroot()
 
-
-
-
-
 with open('data.csv', 'wb') as csvfile:
     spamwriter = csv.writer(csvfile)
     for neighbor in root.iter('DATI'):
         parent = neighbor.attrib.get("ISTANTE")
-        temp = ""
-        for child in neighbor:
-            temp = temp + child.text + ","
-        temp = temp[:-1]
-        spamwriter.writerow([parent, temp])
+        parent = parent[:-4]
+        vm = neighbor[0].text
+        vmin = neighbor[1].text
+        vmax = neighbor[1].text
+        spamwriter.writerow([parent, vm, vmin, vmax])

File diff suppressed because it is too large
+ 0 - 0
data.xml


Some files were not shown because too many files changed in this diff