aDict = {'59333': "Gravity", '59334': "Magnetics", '61297': "Radar", '61299': "Landsat", '62227': "Fieldwork" } idVal = "59333;59334;61297;9999;61299;62227" idList = idVal.split(';') outStr = '' for val in idList: if val in aDict.keys(): word = aDict[val] else: word = "Unknown" if len(outStr) > 0: word = ";%s" % (word) outStr = "%s%s" % (outStr, word) print '\n', outStr
aDict = {'59333': "Gravity", '59334': "Magnetics", '61297': "Radar", '61299': "Landsat", '62227': "Fieldwork" } idVal = "59333;59334;61297;9999;61299;62227" idList = idVal.split(';') outStr = '' for val in idList: if val in aDict.keys(): word = aDict[val] else: word = "Unknown" if len(outStr) > 0: word = "; %s" % (word) outStr = "%s%s" % (outStr, word) print '\n', outStr
import arcpy, sys from arcpy import env env.workspace = r"C:\temp\python\test.gdb" fc = 'gages' fields = ['REF_ID', 'DATA_SOURCE'] with arcpy.da.UpdateCursor(fc, ["REF_ID", "DATA_SOURCE"]) as cursor: for row in cursor: if row[0] == 59333: row[1] = 'Gravity' elif row[0] == 59334: row[1] = 'Magnetics' elif row[0] == 61297: row[1] = 'Radar' .... ..... cursor.updateRow(row)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.