import locale as LOCALE fo = open("weights.txt", "r") fw = open("weights.gwt", "w") header = fo.readline() fw.write("%s" % header) data = fo.readlines() for row in data: rowVals = row.split() rowID = rowVals[0] weights = rowVals[1:] for colID, weight in enumerate(weights): w = LOCALE.atof(weight) if w != 0.0: fw.write("%s %i %s\n" % (rowID, colID+1, weight)) fo.close() fw.close()
fw.write("%s %s %s\n" % (header.strip(), "NID", "WEIGHT"))
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.