Muskie77

How to create a shapefile from a python list using ArcPy?

Discussion created by Muskie77 on Apr 22, 2014
Latest reply on Apr 22, 2014 by mzcoyle
I've been looking for a way to create a shapefile from a python list (in the case below, uniqueList).

Basically, I have been using SearchCursor's to iterate through a shapefile, and I would like to export the result as a shapefile...I tried CopyFeatures...but it didn't even return a blank file (it returned nothing).

import arcpy

def find_overlaps(input_features, output_features):
   uniqueList = []
   for row in arcpy.da.SearchCursor(input_features, ('OBJECTID', 'SHAPE@', 'name')):
      foundMatch = False
      for row2 in uniqueList:
          if row[1].equals(row2[1]):
              foundMatch = True
              break
      if foundMatch == False
          uniqueList.append(row)
   return uniqueList
   ## no work ##
   arcpy.management.CopyFeatures(uniqueList, output_features)

Outcomes