I tried to copy all features in a list of dictionaries. The code looks as follows:
def iterate_features(self): feature_set = arcpy.SearchCursor(self.address) for feature in feature_set: yield feature def create_new_dict(self): iterator = self.iterate_features() if u"Matched_to" not in self.fieldList[:]: #arcpy.AddField_management(input_data, u"Matched_to", "TEXT") for item in iterator: feature = dict() for f in self.fieldList: feature[f] = item.getValue(f) feature[u"Matched_to"]= else: for item in iterator: feature = dict() for f in self.fieldList: feature[f] = item.getValue(f) self.new_features_dict.append(feature)
Now that I want to fetch the
Matched_to list, what it returns is a Unicode object instead of a list. Hence I cannot append anything to it. Moreover, the field
Matched_to is added to the shapefile without being updated or edited. I think it has something to do with shallow and deep copy but I don't know how and where to implement it.