<?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 Prepare list of field names for Transpose Tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/prepare-list-of-field-names-for-transpose-tool/m-p/1233299#M66117</link>
    <description>&lt;P&gt;I want to generate a list of field names to use a input&lt;SPAN&gt;&amp;nbsp;for arcpy.TransposeFields_management.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The list of fields for the transpose needs to be in this format:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in_field="VALUE1 VALUE1;VALUE2 VALUE; VALUE3 VALUE3"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but the closest I can get is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in_field="VALUE1; VALUE1;VALUE2; VALUE; VALUE3; VALUE3"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;using code below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I prepare a list of field names for transpose tool?&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;field_names = []
fields = arcpy.ListFields(TabulateArea)
for field in fields:
        field_names.append(field.name)
del field_names[0:2] #Don't need first two fields
a = field_names
b = []
for i in a:
    b.extend([i,I]) #duplicating field names
delimited_list = ' ;'.join(b) # adding semi-colon and space
print(delimited_list)
VALUE_2 ;VALUE_2 ;VALUE_8 ;VALUE_8 ;VALUE_9 ;VALUE_9 ;VALUE_10 ;VALUE_10 ;VALUE_11 ;VALUE_11 ;VALUE_17 ;VALUE_17&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2022 17:27:40 GMT</pubDate>
    <dc:creator>ChelseaVSmith</dc:creator>
    <dc:date>2022-11-18T17:27:40Z</dc:date>
    <item>
      <title>Prepare list of field names for Transpose Tool</title>
      <link>https://community.esri.com/t5/python-questions/prepare-list-of-field-names-for-transpose-tool/m-p/1233299#M66117</link>
      <description>&lt;P&gt;I want to generate a list of field names to use a input&lt;SPAN&gt;&amp;nbsp;for arcpy.TransposeFields_management.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The list of fields for the transpose needs to be in this format:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in_field="VALUE1 VALUE1;VALUE2 VALUE; VALUE3 VALUE3"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but the closest I can get is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in_field="VALUE1; VALUE1;VALUE2; VALUE; VALUE3; VALUE3"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;using code below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I prepare a list of field names for transpose tool?&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;field_names = []
fields = arcpy.ListFields(TabulateArea)
for field in fields:
        field_names.append(field.name)
del field_names[0:2] #Don't need first two fields
a = field_names
b = []
for i in a:
    b.extend([i,I]) #duplicating field names
delimited_list = ' ;'.join(b) # adding semi-colon and space
print(delimited_list)
VALUE_2 ;VALUE_2 ;VALUE_8 ;VALUE_8 ;VALUE_9 ;VALUE_9 ;VALUE_10 ;VALUE_10 ;VALUE_11 ;VALUE_11 ;VALUE_17 ;VALUE_17&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 17:27:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/prepare-list-of-field-names-for-transpose-tool/m-p/1233299#M66117</guid>
      <dc:creator>ChelseaVSmith</dc:creator>
      <dc:date>2022-11-18T17:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Prepare list of field names for Transpose Tool</title>
      <link>https://community.esri.com/t5/python-questions/prepare-list-of-field-names-for-transpose-tool/m-p/1233311#M66118</link>
      <description>&lt;P&gt;like this?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = ['a', 'b', 'c', 'd', 'e']  # -- list fields
";".join([f'{i} {i}' for i in a])
'a a;b b;c c;d d;e e'&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 18 Nov 2022 17:51:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/prepare-list-of-field-names-for-transpose-tool/m-p/1233311#M66118</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-11-18T17:51:34Z</dc:date>
    </item>
  </channel>
</rss>

