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()
# if you're using Python 2.5
outfile.write("%s,%s,%s,%s\n" % (SPECIES, ECO_ID, OCCUR, COUNT))
# if you're using Python 2.6+
outfile.write("{1},{2},{3},{4}\n".format(SPECIES, ECO_ID, OCCUR, COUNT))
# or this...
outfile.write(",".join([SPECIES, ECO_ID, OCCUR, COUNT + "\n"]))