import arcpy outputTxtFile = r"C:\csny490\myfile.txt" #output comma delimited text file myGrid = r"C:\csny490\mm_from_space\wa06_mean4bin" #input raster file fieldList = arcpy.ListFields(myGrid) #make a list of the fields f = open(outputTxtFile, 'w') #open the text file for writting f.write(",".join(['"'+ field.name + '"' for field in fieldList]) + "\n") #write the header (field names) using list comprehension searchRows = arcpy.SearchCursor(myGrid) #open a search cursor for searchRow in searchRows: #loop through the rows f.write(",".join([str(searchRow.getValue(field.name)) for field in fieldList]) + "\n") #write out the field values of each row using list comprehension del searchRow, searchRows #delete the cursor objects f.close() #close the text file
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.