Revision 83
Added by Aaron Marcuse-Kubitza about 13 years ago
map | ||
---|---|---|
71 | 71 |
map_ = dict(mappings) |
72 | 72 |
reader = csv.reader(sys.stdin) |
73 | 73 |
fieldnames = reader.next() |
74 |
row_idx = 0 |
|
75 |
for row in reader: |
|
74 |
for row_idx, row in enumerate(reader): |
|
76 | 75 |
row_id = str(row_idx) |
77 | 76 |
def put_col(name, value): |
78 | 77 |
xpath.put_obj(out_doc, map_[name], row_id, has_types, value) |
79 | 78 |
for idx, name in enumerate(fieldnames): |
80 | 79 |
if row[idx] != '' and name in map_: put_col(name, row[idx]) |
81 |
row_idx += 1 |
|
82 | 80 |
doc = out_doc |
83 | 81 |
|
84 | 82 |
# Output XML tree |
Also available in: Unified diff
Changed for loops to use enumerate() where the index is also needed