<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Export Feature Attribute to ASCII question in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384447#M30306</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the reply, but I am really new to python and not sure how that would fit into this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# 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:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the current workspace (to avoid having to specify the full path to the feature classes each time)

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = workspace

 

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Export Feature Attribute to ASCII...

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ExportXYv_stats(input_features, ["value_field_A","value_field_B","value_field_C"], "COMMA", export_ASCII, "ADD_FIELD_NAMES")

 

except:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred when running the tool, print out the error message.

&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:41:27 GMT</pubDate>
    <dc:creator>DC</dc:creator>
    <dc:date>2021-12-11T17:41:27Z</dc:date>
    <item>
      <title>Export Feature Attribute to ASCII question</title>
      <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384445#M30304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know a way to export every "Value_Field" in a shape file without specifically using the name of every one individually? In other words is there some kind of wildcard value or loop that will just export every single "Value_Field" that is in the shape file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExportXYv_stats (Input_Feature_Class, Value_Field, Delimiter, Output_ASCII_File, Add_Field_Names_to_Output)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 16:25:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384445#M30304</guid>
      <dc:creator>DC</dc:creator>
      <dc:date>2012-04-09T16:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Export Feature Attribute to ASCII question</title>
      <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384446#M30305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I believe you are looking for something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fields = arcpy.ListFields(&amp;lt;your_layer&amp;gt;)
field_text = list()
for f in fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fields.type != "Geometry":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field_text.append(f.name)

arcpy.ExportXYv_stats(&amp;lt;your_layer&amp;gt;,field_text,"COMMA","C:/GIS/Exports/test2.asc","ADD_FIELD_NAMES")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384446#M30305</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T17:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Export Feature Attribute to ASCII question</title>
      <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384447#M30306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the reply, but I am really new to python and not sure how that would fit into this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# 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:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the current workspace (to avoid having to specify the full path to the feature classes each time)

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = workspace

 

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Export Feature Attribute to ASCII...

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ExportXYv_stats(input_features, ["value_field_A","value_field_B","value_field_C"], "COMMA", export_ASCII, "ADD_FIELD_NAMES")

 

except:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred when running the tool, print out the error message.

&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384447#M30306</guid>
      <dc:creator>DC</dc:creator>
      <dc:date>2021-12-11T17:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Export Feature Attribute to ASCII question</title>
      <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384448#M30307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anyone else have any ideas on this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 12:39:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384448#M30307</guid>
      <dc:creator>DC</dc:creator>
      <dc:date>2012-04-11T12:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Export Feature Attribute to ASCII question</title>
      <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384449#M30308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Anyone else have any ideas on this?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would use mathew's solution. Your code should look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# 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:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fields.type != "Geometry":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field_text.append(f.name)
 
export_ASCII = "ExportFile.txt"
 
 
 
try:
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the current workspace (to avoid having to specify the full path to the feature classes each time)
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = workspace
 
 
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Export Feature Attribute to ASCII...
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ExportXYv_stats(input_features, field_text, "COMMA", export_ASCII, "ADD_FIELD_NAMES")
 
 
 
except:
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred when running the tool, print out the error message.
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()
 &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:41:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384449#M30308</guid>
      <dc:creator>ScottBlankenbeckler</dc:creator>
      <dc:date>2021-12-11T17:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Export Feature Attribute to ASCII question</title>
      <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384450#M30309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah, I got it to work with a couple changes.&amp;nbsp; Thank you both for the help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; input_features = "ShapeFile.shp" needed the entire path instead of just the file name in order to work with arcpy.ListFields for some reason&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. "if &lt;/SPAN&gt;&lt;STRONG&gt;fields&lt;/STRONG&gt;&lt;SPAN&gt;.type != ...." needed to be changed to "if &lt;/SPAN&gt;&lt;STRONG&gt;f&lt;/STRONG&gt;&lt;SPAN&gt;.type != ...."&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 16:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384450#M30309</guid>
      <dc:creator>DC</dc:creator>
      <dc:date>2012-04-11T16:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Export Feature Attribute to ASCII question</title>
      <link>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384451#M30310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Really appreciate you guys taking time to document this.&amp;nbsp; Am a Python novice, too.&amp;nbsp; Made a big contribution to my project.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 14:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-feature-attribute-to-ascii-question/m-p/384451#M30310</guid>
      <dc:creator>DonBarker</dc:creator>
      <dc:date>2012-04-16T14:48:40Z</dc:date>
    </item>
  </channel>
</rss>

