<?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: Confused with this error &amp;quot;list indices must be integers&amp;quot; in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256489#M19728</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You get that error if your list is empty. Try posting your entire code that may help track down the problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jul 2012 16:46:52 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2012-07-31T16:46:52Z</dc:date>
    <item>
      <title>Confused with this error &amp;amp;quot;list indices must be integers&amp;amp;quot;</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256483#M19722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Morning, I'm receiving this error when running a For loop "list indices must be integers". Could this be because my list is of stype string?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code. First I write values to list lMembers&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;rowMembers = arcpy.SearchCursor(fc6,qTeam) &amp;nbsp;&amp;nbsp;&amp;nbsp; lMembers = [] &amp;nbsp;&amp;nbsp;&amp;nbsp; for z in rowMembers: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mName = z.getValue("Name") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lMembers.append(mName) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I later try to write these values. Currently I'm just displaying them for debugging.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in lMembers: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wMembers = lMembers&lt;I&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(lMembers&lt;I&gt;) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(wMembers)&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not quite sure what I'm doing incorrectly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks in advance for you help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 15:34:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256483#M19722</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2012-07-31T15:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256484#M19723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What are you trying to accomplish? You are referencing your list items as an index which isn't how it works. Your i variable holds your list value. Try this to see if it is what you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in lMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(i)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: If for whatever reason you need the index value as well, use the enumerate built-in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for index,item in enumerate(lMembers):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(index,item)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:38:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256484#M19723</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T12:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256485#M19724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The line&lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;for i in lMembers:&lt;/PRE&gt;&lt;SPAN&gt;assigns an item, not an index, from the lMembers list for each iteration. The next line:&lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;wMembers = lMembers&lt;I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;SPAN&gt; is probably where your error is occuring. It is trying to extract the i'th value from the list, but since i is a string instead of an integer, the error occurs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to assign wMembers the value found in the lMembers list for each iteration of the for loop, you should change that line to&lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lMembers = i&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 15:55:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256485#M19724</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2012-07-31T15:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256486#M19725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's a better explanation&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The list lMembers contains values such as [jon, pete, paul, steve, etc]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when I iterate that list later I want to pull the values from this list and write them to an output, building an FDF file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is attempting to do the following&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
loop for as many times as there are items in the list

for each list item, write that value to a output variable that can then be written out

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:38:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256486#M19725</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2021-12-11T12:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256487#M19726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Here's a better explanation&lt;BR /&gt;&lt;BR /&gt;The list lMembers contains values such as [jon, pete, paul, steve, etc]&lt;BR /&gt;&lt;BR /&gt;when I iterate that list later I want to pull the values from this list and write them to an output, building an FDF file. &lt;BR /&gt;&lt;BR /&gt;The code is attempting to do the following&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
loop for as many times as there are items in the list

for each list item, write that value to a output variable that can then be written out

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure how to create an FDF file. All you need to do to get each item in the list is this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for item in lMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Write item to output&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:38:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256487#M19726</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T12:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256488#M19727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can do the FDF part (let me know if you're interested in how that works. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if I try the following, I receive this error. &amp;lt;type 'exceptions.NameError'&amp;gt;: name 'item' is not defined&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for item in lMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wMembers = item
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(item)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lMembers is a list of peoples names, the number of folks vary. I need to write these names to variables to build my FDF file. So i actually need two variables creates, one for the variable name and one containing the persons name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought I'd simplify my question by just asking how to pull the name value from the list. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the end I'm looking to get something like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;variable item+numeric number for item (this would be the variable field placeholder, so 1, 2, 3, 4, etc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;variable name+ value for item (this is the string value from the lMembers, Jon, Steve, Amy, etc.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the code will look somewhat like that, that writes the files&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
txt.write("&amp;lt;&amp;lt;/T(item)/V(" + str(name) + ")&amp;gt;&amp;gt;\n")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:38:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256488#M19727</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2021-12-11T12:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256489#M19728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You get that error if your list is empty. Try posting your entire code that may help track down the problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 16:46:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256489#M19728</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-07-31T16:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256490#M19729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok thanks, here goes. Note that I haven't written code to write out the lMembers info yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

#arcpy.env.workspace = workspc
arcpy.env.overwriteOutput = "True"

from arcpy import env

# Pull data from Incident_Information FC
fc1="Incident_Information" 
rows = arcpy.SearchCursor(fc1)
row = rows.next()
arcpy.AddMessage(fc1)

while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Loop through rowns and pull incident name from Incident_Name field
&amp;nbsp;&amp;nbsp;&amp;nbsp; Incident_Name = row.getValue("Incident_Name")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("while loop 1")
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.next()
del rows
del row

# Loops through the Assignmets table and read field values to vars
fc2="Assignments"

rows = arcpy.SearchCursor(fc2)
arcpy.AddMessage(fc2)
row = rows.next()

# Pull data from the Assignments feature class aVar from Assignments
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Get Assignment Information")
&amp;nbsp;&amp;nbsp;&amp;nbsp; aAssign = row.getValue("Assignments.Assignment_Number")
&amp;nbsp;&amp;nbsp;&amp;nbsp; aDesc = row.getValue("Assignments.Description")
&amp;nbsp;&amp;nbsp;&amp;nbsp; aMiles = row.getValue("Assignments.Mileage")
&amp;nbsp;&amp;nbsp;&amp;nbsp; aInsertion = row.getValue("Assignments.Insertion")
&amp;nbsp;&amp;nbsp;&amp;nbsp; aStatus = row.getValue("Assignments.Status")
&amp;nbsp;&amp;nbsp;&amp;nbsp; aOpPeriod = row.getValue("Assignments.Period")
&amp;nbsp;&amp;nbsp;&amp;nbsp; aTeam = row.getValue("Assignments.Team_Name")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Pull data from Op Period FC using Period number
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Matching Operation Period")
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc4 = "Operation_Period"
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowPeriod = arcpy.SearchCursor(fc4, "Period = " + str(aOpPeriod))
&amp;nbsp;&amp;nbsp;&amp;nbsp; # loops through operation periods and reads values into vars based on Op number pVar for Period
&amp;nbsp;&amp;nbsp;&amp;nbsp; for x in rowPeriod:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWeather = x.getValue("Weather")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pSafety = x.getValue("Safety_Message")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFreqP = x.getValue("Primary_Comms")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFreqE = x.getValue("Emergency_Comms")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pPlans = x.getValue("Planning_Chief")
&amp;nbsp;&amp;nbsp;&amp;nbsp; del x

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Pull data from Teams FC using Assignment Number building quesry in var qTeam 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Matching Teams")
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc5 = "Teams"
&amp;nbsp;&amp;nbsp;&amp;nbsp; qTeam = '"Team_Name"' + "='" + str(aTeam) + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(qTeam)
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowPeriod = arcpy.SearchCursor(fc5,qTeam)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # loops through Teams and reads values into vars based on Team name tVar for Team
&amp;nbsp;&amp;nbsp;&amp;nbsp; for y in rowPeriod:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tType = y.getValue("Team_Type")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tCallSign = y.getValue("radio_Call_Sign")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tLeader = y.getValue("Leader")
&amp;nbsp;&amp;nbsp;&amp;nbsp; del y
&amp;nbsp;&amp;nbsp;&amp;nbsp; del rowPeriod
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Pull data from Team Members FC using Team Name building query in mVar 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Matching Team Members")
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc6 = "Team_Members"
&amp;nbsp;&amp;nbsp;&amp;nbsp; qTeam = '"Team_Name"' + "='" + str(aTeam) + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(qTeam)
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowMembers = arcpy.SearchCursor(fc6,qTeam)
&amp;nbsp;&amp;nbsp;&amp;nbsp; lMembers = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; # loops through Teams and reads values into list lMembers. List = lVar
&amp;nbsp;&amp;nbsp;&amp;nbsp; z = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for z in rowMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mName = z.getValue("Name")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lMembers.append(mName) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(mName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; del z
&amp;nbsp;&amp;nbsp;&amp;nbsp; del rowMembers
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Building Assignment Number " + str(aAssign))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create new fdf file
&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = output + "/" + str(aAssign) + ".fdf"

&amp;nbsp;&amp;nbsp;&amp;nbsp; txt= open (filename, "w")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("%FDF-1.2\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("%????\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("1 0 obj&amp;lt;&amp;lt;/FDF&amp;lt;&amp;lt;/F(ICS-204.pdf)/Fields 2 0 R&amp;gt;&amp;gt;&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("endobj\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("2 0 obj[\n")

&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write ("\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Write field names to FDF file
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(incident_name)/V(" + str(Incident_Name) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(assignment_number)/V(" + str(aAssign) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(operational_period)/V(" + str(aOpPeriod) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(asgn_description)/V(" + str(aDesc) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(resource_type)/V(" + str(tType) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(asgn.description)/V(" + str(aDesc) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(.size_of_assignment)/V(" + str(aMiles) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(transport_instructions)/V(" + str(aInsertion) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(radio_call)/V(" + str(tCallSign) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(freq_command)/V(" + str(pFreqP) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(freq_command)/V(" + str(pFreqE) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(prepared_by)/V(" + str(pPlans) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(notes)/V(" + str(pWeather) + ")&amp;gt;&amp;gt;\n")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Write Team Members to FDF file from list lMembers
&amp;nbsp;&amp;nbsp;&amp;nbsp; for item in lMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wMembers = item
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(item)

&amp;nbsp;&amp;nbsp;&amp;nbsp; del item
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Close and write FDF file
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("]\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("endobj\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("trailer\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/Root 1 0 R&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("%%EO\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.close ()

&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.next()
del rows
del row
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I very much appreciate your help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:38:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256490#M19729</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2021-12-11T12:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256491#M19730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How about:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;nameList = [r.Name for r in arcpy.SearchCursor(myFC)]&lt;/PRE&gt;&lt;SPAN&gt;Then...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;i = 0
for name in nameList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Item #" + str(i) + " = " + str(name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a ".index()" method of a list, but it returns the index of the FIRST occurance of the specified item. For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;test = ["john","sam","john"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; test.index("john")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You probably want to be more explicit in this case, and include a counter instead of the list index (which makes the assumption that all the names will always be unique).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:38:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256491#M19730</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T12:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256492#M19731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a case where dictionaries would have been superior. You have nested cursors which is frowned on in some circles, but as long as you know the cost isn't too high it shouldn't break anything. One note, when you are trying to reset a variable, I would avoid setting it to values like z = 0 or z = " ". Use z = None instead. These are mostly minor things and I don't see why your list would be empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this printing out all the expected names?&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for z in rowMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mName = z.getValue("Name")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lMembers.append(mName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(mName)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:38:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256492#M19731</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T12:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256493#M19732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes the names populate correctly. The reason the list 'could' be empty is if there are no people in that Team yet. The team name woudl exist in the teams table by has no members at this time, so i need to account for that. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm very new to Python (like a week) and I'm unaware of dictionaries, which is why I didn't use them &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks for the other tips.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]16519[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've attached the run screen as a screenshot&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 17:30:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256493#M19732</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2012-07-31T17:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256494#M19733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Yes the names populate correctly. The reason the list 'could' be empty is if there are no people in that Team yet. The team name woudl exist in the teams table by has no members at this time, so i need to account for that. &lt;BR /&gt;&lt;BR /&gt;I'm very new to Python (like a week) and I'm unaware of dictionaries, which is why I didn't use them &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks for the other tips.&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]16519[/ATTACH]&lt;BR /&gt;&lt;BR /&gt;I've attached the run screen as a screenshot&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes your list is empty so you will never enter this loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for item in lMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wMembers = item
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(item)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add this line before the loop to avoid undefined problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; item = None&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:39:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256494#M19733</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T12:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256495#M19734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah ha!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So if I'd like to increment wMembers to wMembers+item_Number and another to wMemberName+Item_value&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; item = None
&amp;nbsp;&amp;nbsp;&amp;nbsp; for item in lMembers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wMembers+item_number = item
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wMewmberName+Value_of_lMember
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so i'd end up with&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;wMembers1 containing value Jon P&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;wmembers2 containing value Arnold G&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;wMember3 containing value Pete H&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How would i manage that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:39:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256495#M19734</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2021-12-11T12:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256496#M19735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you talking about creating dynamic variables for each item in your list? I don't think you really want to do that. You would want to use a dictionary to be able to look up when writing your output. Something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;members_dict = {}
for index,name in enumerate(lMembers,1):
&amp;nbsp;&amp;nbsp;&amp;nbsp; members_dict[index] = name&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still not clear on what you are doing with the index number though. Do you have a specific example of what your want your output string to be?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:39:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256496#M19735</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T12:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256497#M19736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry for being unclear. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As I mentioned, ultimately I'm writing values to an FDF file, which will be used in conjunction with a PDF template. The PDF contains fields for each Member, there can be up to 9 members. The fields are named Member1, Member2, etc. through Member9. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The line of code that writes the values out is this. Using the field name in the PDF/FDF, and the data from the script&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
txt.write("&amp;lt;&amp;lt;/T(FDF Field Name)/V(" + str(arcpy variable name) + ")&amp;gt;&amp;gt;\n")
[\code]

I have potentially 9 team members, but not always. I may have none or some, not always 9.

I'm trying to write these values in a loop. So something like this

Loop through the members list
create a variable for each item in the list
populate that variable with the value from the list
write that variableto the FDF file using txt.write

so the loop would actually contain the txt.write
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for item in lMembers:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FDF_Field_Name = FDF_Field_Name+item 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FDF_Field_Name+item = lmembers+string_value

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(FDF_Field_Name)/V(" + str(FDF_Field_Name+item) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(item)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;something like that, probably clear as mud now ;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:39:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256497#M19736</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2021-12-11T12:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256498#M19737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Sorry for being unclear. &lt;BR /&gt;&lt;BR /&gt;As I mentioned, ultimately I'm writing values to an FDF file, which will be used in conjunction with a PDF template. The PDF contains fields for each Member, there can be up to 9 members. The fields are named Member1, Member2, etc. through Member9. &lt;BR /&gt;&lt;BR /&gt;The line of code that writes the values out is this. Using the field name in the PDF/FDF, and the data from the script&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
txt.write("&amp;lt;&amp;lt;/T(FDF Field Name)/V(" + str(arcpy variable name) + ")&amp;gt;&amp;gt;\n")
[\code]

I have potentially 9 team members, but not always. I may have none or some, not always 9.

I'm trying to write these values in a loop. So something like this

Loop through the members list
create a variable for each item in the list
populate that variable with the value from the list
write that variableto the FDF file using txt.write

so the loop would actually contain the txt.write
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for item in lMembers:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FDF_Field_Name = FDF_Field_Name+item 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FDF_Field_Name+item = lmembers+string_value

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T(FDF_Field_Name)/V(" + str(FDF_Field_Name+item) + ")&amp;gt;&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(item)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;something like that, probably clear as mud now ;)&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So would this be an example of the strings you want to pass?&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;FDF_Field_Name = "Member1"
item = "Joe"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256498#M19737</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T12:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256499#M19738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, that's exactly it&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 20:20:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256499#M19738</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2012-07-31T20:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256500#M19739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not sure if you want the FDF_Field_Name variable inserted where you had it as a string before, but I did and you can change it back if that isn't what you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FDF_Field_Name = "Member" &amp;nbsp;&amp;nbsp;&amp;nbsp; for index,item in enumerate(lMembers,1): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name_field = "{0}{1}".format(FDF_Field_Name,index) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; txt.write("&amp;lt;&amp;lt;/T({0})/V({0}{1})&amp;gt;&amp;gt;\n".format(name_field,item)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(item)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Say this is your list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;lMembers = ["Joe","Sue","Anne"]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;This will return for the first loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;name_field = "Member1" item = "Joe"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;With that you can do what you want in terms of formatting for writing to your output.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 20:36:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256500#M19739</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-07-31T20:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256501#M19740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much for all your help today, I'll give this a shot shortly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not really sure exactly what's going on in this loop. Any chance you have time to explain this code? I'd rather learn why this works than blindly copy/paste to resolve my immediate need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 20:52:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256501#M19740</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2012-07-31T20:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Confused with this error "list indices must be integers"</title>
      <link>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256502#M19741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We're almost there, here's the output&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;/T(Member1)/V(Member1Jon P)&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;/T(Member2)/V(Member2Arnold G)&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;/T(Member3)/V(Member3Art F)&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;/T(Member4)/V(Member4Pete H)&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't need the member1Jon P just Jon P in the second part.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 21:03:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/confused-with-this-error-amp-amp-quot-list-indices/m-p/256502#M19741</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2012-07-31T21:03:10Z</dc:date>
    </item>
  </channel>
</rss>

