I need to batch export information from 400 raster attribute tables... I can get it to write a text file delimited by , but it write all of the records on the same line... how do I get it to recognize the fields as column andformat the text file so I can import it into access as a table. here is the code
outfile = open(eco_pa + ".txt", "w")
rows = arcpy.SearchCursor(eco_pa, "OCCUR = 1", "", "COUNT;ECO_ID;SPECIES;OCCUR", "")
for row in rows:
SPECIES = row.getValue("SPECIES")
ECO_ID = row.getValue("ECO_ID")
OCCUR = row.getValue("OCCUR")
COUNT = row.getValue("COUNT")
print SPECIES, ECO_ID, OCCUR, COUNT
outfile.write(str(SPECIES) + "," + str(ECO_ID) + "," + str(OCCUR) + "," + str(COUNT)
outfile.close()