<?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: Move to next item in list in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627286#M48867</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I believe this method is going to work for me.&amp;nbsp; I will get this syntax in the right places.&amp;nbsp; Thanks Greg!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 May 2014 14:15:13 GMT</pubDate>
    <dc:creator>NoahHuntington</dc:creator>
    <dc:date>2014-05-23T14:15:13Z</dc:date>
    <item>
      <title>Move to next item in list</title>
      <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627280#M48861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attempting to utilize a function to save the output of a geoproceessing tool inside a loop.&amp;nbsp; The function iterates thru the list with each iteration of the loop.&amp;nbsp;&amp;nbsp; However if I want to save the output feature class as function " + 1" how do I achieve this. This would be similar to function(count + 1)? Only using characters instead of integers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function:&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;def get_LCP(letter): &amp;nbsp;&amp;nbsp;&amp;nbsp; for letter in ['A','B','C','D','E','F']: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return os.path.join(savepath&amp;nbsp; + "\\Scratch.gdb"&amp;nbsp; + "\\LCP_" + (letter))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Loop:&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = 0 &amp;nbsp;&amp;nbsp;&amp;nbsp; while count &amp;lt; 2: ... &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; costPath2 =CostPath(originValue, setNull2,get_backlink(count + 1),"EACH_CELL","") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; costPath2.save(get_LCP(letter).next) &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 15:32:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627280#M48861</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-05-13T15:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Move to next item in list</title>
      <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627281#M48862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I understand you correctly, it looks like you're looking to save the same output 6 times for each iteration of your while loop.&amp;nbsp; If so, than maybe something like this would work for you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def get_LCP(costPath2):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for letter in ['A','B','C','D','E','F']:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.join(savepath&amp;nbsp; + "\\Scratch.gdb"&amp;nbsp; + "\\LCP_" + letter)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; costPath2.save(path)

count = 0
while count &amp;lt; 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; .....
&amp;nbsp;&amp;nbsp;&amp;nbsp; costPath2 = CostPath(originValue, setNull2,get_backlink(count + 1),"EACH_CELL","")
&amp;nbsp;&amp;nbsp;&amp;nbsp; get_LCP(costPath2)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627281#M48862</guid>
      <dc:creator>MattEiben</dc:creator>
      <dc:date>2021-12-12T02:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Move to next item in list</title>
      <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627282#M48863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Matt,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply. I probably added to confusion having 6 items in the list.&amp;nbsp; What I am looking for is replacing the count index with the equivalent letter.&amp;nbsp; A instead of 0, B instead of 1, so on and so forth... I hope this helps?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 18:32:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627282#M48863</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-05-13T18:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Move to next item in list</title>
      <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627283#M48864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may want to &lt;/SPAN&gt;&lt;A href="https://docs.python.org/2/library/functions.html#chr"&gt;look at chr()&lt;/A&gt;&lt;SPAN&gt;. This will return the string version of the numeric value, for example, chr(97) = 'a'. You'd have to look up the value of the character in your encoding and add that to your counter. For example, &lt;/SPAN&gt;&lt;A href="http://www.asciitable.com/"&gt;in ascii&lt;/A&gt;&lt;SPAN&gt;, A = 65, B = 66, C = 67...a = 97, b = 98...etc. So in ascii, if your counter starts at 0, add 65 to it so that 0 will become A, 1 will become B, etc. Unicode and other encodings are probably different.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 19:01:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627283#M48864</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-13T19:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Move to next item in list</title>
      <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627284#M48865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You may want to &lt;A href="https://docs.python.org/2/library/functions.html#chr"&gt;look at chr()&lt;/A&gt;. This will return the string version of the numeric value, for example, chr(97) = 'a'. You'd have to look up the value of the character in your encoding and add that to your counter. For example, &lt;A href="http://www.asciitable.com/"&gt;in ascii&lt;/A&gt;, A = 65, B = 66, C = 67...a = 97, b = 98...etc. So in ascii, if your counter starts at 0, add 65 to it so that 0 will become A, 1 will become B, etc. Unicode and other encodings are probably different.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Greg!&amp;nbsp; I am not familiar with these properties.&amp;nbsp; I will spend a little time with the literature and see if I can get something to work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Noah&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 19:14:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627284#M48865</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-05-13T19:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Move to next item in list</title>
      <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627285#M48866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;think&lt;/SPAN&gt;&lt;SPAN&gt; what you want to do is change 'get_backlink(count + 1)' to 'get_backlink(chr(count + 64)) ', or possibly to 65 0r 66, can't be sure from your code, since it looks like you first use count when it's 1. Depends on the rest of your code. Since you're first looking for 'A', you want to add whichever number gets you to 65, assuming this is ascii.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, you'll never get past 'C' , since your loop exits once it hits 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: oh, and don't forget to increment count or you'll be in an infinite loop. Maybe that's elsewhere in your code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 20:44:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627285#M48866</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-13T20:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Move to next item in list</title>
      <link>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627286#M48867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I believe this method is going to work for me.&amp;nbsp; I will get this syntax in the right places.&amp;nbsp; Thanks Greg!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 May 2014 14:15:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-to-next-item-in-list/m-p/627286#M48867</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-05-23T14:15:13Z</dc:date>
    </item>
  </channel>
</rss>

