if row == 0: continue elif row == 1: for col in range(s.ncols): statusKeys.append(str(s.cell(row, col).value)) else: for col in range(s.ncols): if col == 0: ITEMS_NAMES.append(str(s.cell(row, col).value)) values.append(str(s.cell(row, col).value)) ITEMS_STATUS_LIST.append(values) print statusKeys print ITEMS_STATUS_LIST doc = XmlWriter() players_setting = doc.createNode(ITEMS_SETTINGS_FILE) for index in range(len(ITEMS_STATUS_LIST)): player_value = doc.createNode(STATUS_TAG, players_setting) for key, value in zip(statusKeys, ITEMS_STATUS_LIST[index]): node_key = doc.createNode(key, player_value) node_value = doc.doc.createTextNode(value) node_key.appendChild(node_value) # doc.printXML() def createXmlFile(file_name): f = codecs.open(os.getcwd() + "\\xml\\" + file_name, 'w', 'utf-8') f.write(doc.doc.toprettyxml())
for col in range(s.ncols): # values.append(str(s.cell(row, col).value)) if col in (1, 4): values.append(unicode(s.cell(row, col).value)) if col == 1: ITEMS_DESCRIPTION.append(unicode(s.cell(row, col).value)) else: if col == 0: ITEMS_NAMES.append(str(s.cell(row, col).value)) values.append(str(s.cell(row, col).value)) ITEMS_STATUS_LIST.append(values) print statusKeys print ITEMS_STATUS_LIST doc = XmlWriter() items_setting = doc.createNode(ITEMS_SETTINGS_FILE) for index in range(len(ITEMS_STATUS_LIST)): enemy_value = doc.createNode(STATUS_TAG, items_setting) for key, value in zip(statusKeys, ITEMS_STATUS_LIST[index]): node_key = doc.createNode(key, enemy_value) node_value = doc.doc.createTextNode(value) node_key.appendChild(node_value) # doc.printXML() def createXmlFile(file_name): f = codecs.open(os.getcwd() + "\\xml\\" + file_name, 'w', 'utf-8') f.write(doc.doc.toprettyxml())
if row == 0: continue elif row == 1: for col in range(s.ncols): statusKeys.append(str(s.cell(row, col).value)) else: for col in range(s.ncols): if col == 0: ITEMS_NAMES.append(str(s.cell(row, col).value)) values.append(str(s.cell(row, col).value)) ITEMS_STATUS_LIST.append(values) print statusKeys print ITEMS_STATUS_LIST doc = XmlWriter() playerLevels_setting = doc.createNode(ITEMS_SETTINGS_FILE) for index in range(len(ITEMS_STATUS_LIST)): level_value = doc.createNode(STATUS_TAG, playerLevels_setting) for key, value in zip(statusKeys, ITEMS_STATUS_LIST[index]): node_key = doc.createNode(key, level_value) node_value = doc.doc.createTextNode(value) node_key.appendChild(node_value) # doc.printXML() def createXmlFile(file_name): f = codecs.open(os.getcwd() + "\\xml\\" + file_name, 'w', 'utf-8') f.write(doc.doc.toprettyxml())