Wouldn't it be nice if you could take one of you python data objects and just "can it" to open up later? With the "pickle" library you can do just that.
I need to compare current data to historical data, so I make a dictionary of OID's with all attributes that looks something like this:
PK99999: (1059, 4, X, Y, etc, etc...) PK00001: (1259, 2, X, Y, etc, etc...)
So, I like to slurp this dictionary up into a pickle, then open it up a month later to compare against the current data.
#--------- WRITE A PICKLE -------------------------------
import pickle import arcgisscripting gp = arcgisscripting.create(9.3)
for k in d1.keys(): # test for differences between 2 dictionaries #print "key: " + str(k) if d2.has_key(k): if d1[k] == d2[k]: print "key: " + str(k) print "------------ same values for key" else: print "key: " + str(k) print "------------ there are differences with 1 or more values" tup1, tup2 = d1[k], d2[k] for i in xrange(len(tup1)): if tup1[i] == tup2[i]: print "d2: " + str(k) + "[" + str(i) + "] ...same" else: print "d2: " + str(k) + "[" + str(i) + "] -------------DIFFERENT!" d3[str(k)] = d2[k] #updateRow(k) print "\n"