<?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  ArcPY Python List in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-python-list/m-p/380571#M29995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="" style="color: #222222; font-size: small;"&gt;I have a problem codding. I wonder if you could give me a hand with this:&lt;/DIV&gt;&lt;DIV class="" style="color: #222222; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV class="" style="color: #222222; font-size: small;"&gt;&lt;DIV class="" style="color: #242729; background-color: #ffffff; border: 0px; padding: 0px 15px 0px 0px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 13px;"&gt;I have this list of tuples:&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="" style="color: #242729; background-color: #ffffff; border: 0px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; margin: 0px 0px 5px;"&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;[['060710080013011', 9, 155], ['060710080013011', 9, 156], ['060710080013011', 9, 157], ['060710080013011', 9, 164], ['060710080013011', 9, 165], ['060710080013011', 9, 166], ['060710080013011', 9, 170], ['060710080013011', 9, 171], ['060710080013011', 9, 172], ['060710080013033', 8, 86], ['060710080013033', 8, 90], ['060710080013033', 8, 91], ['060710080013033', 8, 97], ['060710080013033', 8, 99], ['060710080013033', 8, 100], ['060710080013033', 8, 103], ['060710080013033', 8, 105], ['060710080021000', 10, 87], ['060710080021000', 10, 88], ['060710080021000', 10, 89], ['060710080021000', 10, 92], ['060710080021000', 10, 93], ['060710080021000', 10, 94], ['060710080021000', 10, 95], ['060710080021000', 10, 96], ['060710080021000', 10, 98], ['060710080021000', 10, 102]]&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;So the first value is an ID y the second value is how many times this id is appearing on the list. The problem is the following.&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;When the second value is greater than 7, I need to change the values in every second item in each tuple here the example:&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;[['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 155], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 156], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7,&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;157], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 164], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7,&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;165], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 166], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 170], ['&lt;STRONG style="border: 0px; font-weight: bold;"&gt;060710080013011_2&lt;/STRONG&gt;',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;2&lt;/STRONG&gt;, 171], ['&lt;STRONG style="border: 0px; font-weight: bold;"&gt;060710080013011_2&lt;/STRONG&gt;',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;2&lt;/STRONG&gt;, 172]]&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;As you can see, instead of having 9 in all the values, I have 7 and 2, and I have to change the id of the left 2 adding a '_2' at the end. Basically, the rule is, id the value is greater than 7, then divide the value by 7. and put the residual in the rest of values. It could be the case that a value has 15 appearances. In that case, we will have 2 groups of 7 and one of 1&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;Please, I have been trying to solve this a lot of time, I can not find a solution.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 May 2018 20:19:57 GMT</pubDate>
    <dc:creator>CesarGarrido_Lecca_Rivera</dc:creator>
    <dc:date>2018-05-24T20:19:57Z</dc:date>
    <item>
      <title>ArcPY Python List</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-python-list/m-p/380571#M29995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="" style="color: #222222; font-size: small;"&gt;I have a problem codding. I wonder if you could give me a hand with this:&lt;/DIV&gt;&lt;DIV class="" style="color: #222222; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV class="" style="color: #222222; font-size: small;"&gt;&lt;DIV class="" style="color: #242729; background-color: #ffffff; border: 0px; padding: 0px 15px 0px 0px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 13px;"&gt;I have this list of tuples:&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="" style="color: #242729; background-color: #ffffff; border: 0px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; margin: 0px 0px 5px;"&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;[['060710080013011', 9, 155], ['060710080013011', 9, 156], ['060710080013011', 9, 157], ['060710080013011', 9, 164], ['060710080013011', 9, 165], ['060710080013011', 9, 166], ['060710080013011', 9, 170], ['060710080013011', 9, 171], ['060710080013011', 9, 172], ['060710080013033', 8, 86], ['060710080013033', 8, 90], ['060710080013033', 8, 91], ['060710080013033', 8, 97], ['060710080013033', 8, 99], ['060710080013033', 8, 100], ['060710080013033', 8, 103], ['060710080013033', 8, 105], ['060710080021000', 10, 87], ['060710080021000', 10, 88], ['060710080021000', 10, 89], ['060710080021000', 10, 92], ['060710080021000', 10, 93], ['060710080021000', 10, 94], ['060710080021000', 10, 95], ['060710080021000', 10, 96], ['060710080021000', 10, 98], ['060710080021000', 10, 102]]&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;So the first value is an ID y the second value is how many times this id is appearing on the list. The problem is the following.&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;When the second value is greater than 7, I need to change the values in every second item in each tuple here the example:&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;[['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 155], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 156], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7,&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;157], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 164], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7,&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;165], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 166], ['060710080013011',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;7&lt;/STRONG&gt;, 170], ['&lt;STRONG style="border: 0px; font-weight: bold;"&gt;060710080013011_2&lt;/STRONG&gt;',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;2&lt;/STRONG&gt;, 171], ['&lt;STRONG style="border: 0px; font-weight: bold;"&gt;060710080013011_2&lt;/STRONG&gt;',&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;2&lt;/STRONG&gt;, 172]]&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;As you can see, instead of having 9 in all the values, I have 7 and 2, and I have to change the id of the left 2 adding a '_2' at the end. Basically, the rule is, id the value is greater than 7, then divide the value by 7. and put the residual in the rest of values. It could be the case that a value has 15 appearances. In that case, we will have 2 groups of 7 and one of 1&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; margin: 0px 0px 1em;"&gt;Please, I have been trying to solve this a lot of time, I can not find a solution.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2018 20:19:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-python-list/m-p/380571#M29995</guid>
      <dc:creator>CesarGarrido_Lecca_Rivera</dc:creator>
      <dc:date>2018-05-24T20:19:57Z</dc:date>
    </item>
    <item>
      <title>Re:  ArcPY Python List</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-python-list/m-p/380572#M29996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just an FYI, what you presented in the question is a list of lists, not a list of tuples.&amp;nbsp; Maybe your code is different than what you showed here, but I doubt you are using tuples since they are immutable and you would be getting errors trying to update values in them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before suggesting a solution, what would happen in your 15 appearances example?&amp;nbsp; You state there would be 2 groups of 7, what would the ID sequence look like after it is modified?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2018 13:39:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-python-list/m-p/380572#M29996</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-05-25T13:39:34Z</dc:date>
    </item>
    <item>
      <title>Re:  ArcPY Python List</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-python-list/m-p/380573#M29997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your question is about getting lost within Lists of Lists and how to reference particular elements within python... maybe this would help&amp;nbsp;&lt;A class="link-titled" href="https://stackoverflow.com/questions/18449360/access-item-in-a-list-of-lists" title="https://stackoverflow.com/questions/18449360/access-item-in-a-list-of-lists"&gt;python - Access item in a list of lists - Stack Overflow&lt;/A&gt;&amp;nbsp; &amp;nbsp;Again as Joshua indicated we are only guessing at what you need?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2018 14:28:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-python-list/m-p/380573#M29997</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2018-05-25T14:28:43Z</dc:date>
    </item>
  </channel>
</rss>

