import arcpy fields = arcpy.ListFields(<your_layer>) field_text = list() for f in fields: if fields.type != "Geometry": field_text.append(f.name) arcpy.ExportXYv_stats(<your_layer>,field_text,"COMMA","C:/GIS/Exports/test2.asc","ADD_FIELD_NAMES")
# Export feature locations and attributes to an ASCII text file # Import system modules import arcpy # Local variables... workspace = "C:\Users\me\Desktop\InputFolder.ospfds" input_features = "ShapeFile.shp" export_ASCII = "ExportFile.txt" try: # Set the current workspace (to avoid having to specify the full path to the feature classes each time) arcpy.env.workspace = workspace # Process: Export Feature Attribute to ASCII... arcpy.ExportXYv_stats(input_features, ["value_field_A","value_field_B","value_field_C"], "COMMA", export_ASCII, "ADD_FIELD_NAMES") except: # If an error occurred when running the tool, print out the error message. print arcpy.GetMessages()
Anyone else have any ideas on this?
# Export feature locations and attributes to an ASCII text file # Import system modules import arcpy # Local variables... workspace = "C:\Users\me\Desktop\InputFolder.ospfds" input_features = "ShapeFile.shp" fields = arcpy.ListFields (input_features ) field_text = list() for f in fields: if fields.type != "Geometry": field_text.append(f.name) export_ASCII = "ExportFile.txt" try: # Set the current workspace (to avoid having to specify the full path to the feature classes each time) arcpy.env.workspace = workspace # Process: Export Feature Attribute to ASCII... arcpy.ExportXYv_stats(input_features, field_text, "COMMA", export_ASCII, "ADD_FIELD_NAMES") except: # If an error occurred when running the tool, print out the error message. print arcpy.GetMessages()