<?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: In this example, how do I write a Python script to accomplish this?  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152857#M11795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The link is "&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" data-containerid="1519" data-containertype="700" data-objectid="192672" data-objecttype="1" href="https://community.esri.com/thread/192672-sequential-numbering-python-script-for-field-calculator-in-arc-102"&gt;https://community.esri.com/thread/192672-sequential-numbering-python-script-for-field-calculator-in-arc-102&lt;/A&gt;&lt;SPAN&gt;".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I don't have Pro and I would have to do this from Field Calc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charles&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jun 2018 13:01:09 GMT</pubDate>
    <dc:creator>CharlesBanks2</dc:creator>
    <dc:date>2018-06-27T13:01:09Z</dc:date>
    <item>
      <title>In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152853#M11791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this example, how do I write a Python script to accomplish this result:&lt;/P&gt;&lt;P&gt;Site&amp;nbsp; &amp;nbsp;ID&lt;/P&gt;&lt;P&gt;SIte A 0001&lt;/P&gt;&lt;P&gt;Site A 0001&lt;/P&gt;&lt;P&gt;SIte A 0001&lt;/P&gt;&lt;P&gt;Site A 0001&lt;/P&gt;&lt;P&gt;Site B 0002&lt;/P&gt;&lt;P&gt;SIte B 0002&lt;/P&gt;&lt;P&gt;Site B 0002&lt;/P&gt;&lt;P&gt;Site C 0003&lt;/P&gt;&lt;P&gt;SIte D 0004&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 12:40:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152853#M11791</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-27T12:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152854#M11792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am suspecting that there is more to it than that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;What is the purpose of the code?&lt;/LI&gt;&lt;LI&gt;Do any of the values exist before hand?&lt;/LI&gt;&lt;LI&gt;are you reading the file from somewhere?&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;What have you tried!&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 12:44:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152854#M11792</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-27T12:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152855#M11793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is in connection with post: "Sequential Numbering Python Script for&lt;/P&gt;&lt;P&gt;Field Calculator in Arc 10.2" but a different sequence in the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charles Banks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 12:50:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152855#M11793</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-27T12:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152856#M11794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well it can be done easily in more recent versions ( &lt;SPAN style="color: #0b0119;"&gt;&lt;A href="https://www.arcgis.com/home/item.html?id=90d9ca933e8c4b96bf341a20ae1f2514"&gt;Table tools for ArcGIS PRO&lt;/A&gt; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0b0119;"&gt;but perhaps if you included the link someone with an older version of ArcMap (or even 10.6) could have a look at what was posted there&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 12:55:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152856#M11794</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-27T12:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152857#M11795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The link is "&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" data-containerid="1519" data-containertype="700" data-objectid="192672" data-objecttype="1" href="https://community.esri.com/thread/192672-sequential-numbering-python-script-for-field-calculator-in-arc-102"&gt;https://community.esri.com/thread/192672-sequential-numbering-python-script-for-field-calculator-in-arc-102&lt;/A&gt;&lt;SPAN&gt;".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I don't have Pro and I would have to do this from Field Calc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charles&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 13:01:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152857#M11795</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-27T13:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152858#M11796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code I posted is in that link... you just need to change the field name that contains the source classification&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;seq_count&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;!Test!&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in that thread's example the Site stuff was in a field called Test. &amp;nbsp;&lt;/P&gt;&lt;P&gt;You just need to do a field calculation with seq_count as the Code block and the seq_count(!YourFieldName!) as the expression.&lt;/P&gt;&lt;P&gt;Of course, you have to set the field calculator to the python parser&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 14:35:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152858#M11796</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-27T14:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152859#M11797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This script does &lt;STRONG&gt;not&lt;/STRONG&gt; produce the sequence above, it does work though!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 14:49:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152859#M11797</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-27T14:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152860#M11798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't produce the exact sequence because... your data are different I suspect.&lt;/P&gt;&lt;P&gt;Perhaps you should show the data you are trying to produce a sequence for... or are you not following what the script does exactly?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 14:55:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152860#M11798</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-27T14:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152861#M11799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a sample of what needs to be:&lt;/P&gt;&lt;TABLE width="591"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="346"&gt;FIELD&lt;/TD&gt;&lt;TD width="245"&gt;NEED TO BE&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999TUNK10_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999TUNK10_001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999TUNK10_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999TUNK10_001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999TUNK10_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999TUNK10_001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999BANK12_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999BANK12_002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999BANK17_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999BANK17_003&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999BANK1_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999BANK1_004&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999BANK20_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999BANK20_005&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999BANK20_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999BANK20_005&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999BANK20_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999BANK20_005&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxx_ 9999BANK30_&lt;/TD&gt;&lt;TD&gt;xxx_ 9999BANK30_006&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 16:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152861#M11799</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-27T16:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152862#M11800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;did you substitute the !Test! name in the field calculator expression and try what I suggested?&lt;/P&gt;&lt;P&gt;perhaps you can take a screen grab of the field calculator dialog so we can see what you are doing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 18:05:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152862#M11800</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-27T18:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152863#M11801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I did, and got something like this:&lt;/P&gt;&lt;TABLE style="background-color: #ffffff; border: 0px; margin: 0px 0px 2px;" width="591"&gt;&lt;TBODY style="border: inherit solid inherit; font-weight: inherit;"&gt;&lt;TR style="border: inherit solid inherit; font-weight: inherit;"&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;" width="346"&gt;FIELD&lt;/TD&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;" width="245"&gt;NEED TO BE&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit; font-weight: inherit;"&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999TUNK10_&lt;/TD&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999TUNK10_001&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit; font-weight: inherit;"&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999TUNK10_&lt;/TD&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999TUNK10_002&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit; font-weight: inherit;"&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999TUNK10_&lt;/TD&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999TUNK10_003&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit; font-weight: inherit;"&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999BANK12_&lt;/TD&gt;&lt;TD style="border: inherit solid inherit; padding: 2px 4px;"&gt;xxx_ 9999BANK12_002&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 18:19:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152863#M11801</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-27T18:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152864#M11802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# lines 7... change to&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# ---- try changing this&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{} {:04.0f}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;val&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# ---- and this&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{} {:04.0f}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;val&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:11:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152864#M11802</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T08:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152865#M11803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got an error:&amp;nbsp;999999 : Error executing function.&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;H1&gt;999999 : Error executing function.&lt;/H1&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 18:51:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152865#M11803</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-27T18:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152866#M11804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;show your field calculator dialog with the function and your expression filled in&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any of you other peeps want to leap in... lots of viewers... no suggestions from the gallery???&amp;nbsp; You can take over if you want&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2018 03:35:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152866#M11804</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-28T03:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152867#M11805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry about the delay. Here it is:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/412645_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2018 14:55:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152867#M11805</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-28T14:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152868#M11806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peeping in.....&lt;/P&gt;&lt;P&gt;A dictionary solution could look like something like&amp;nbsp;this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'xxx_9999TUNK10_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999TUNK10_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999TUNK10_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK12_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK17_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK1_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK20_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK20_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK20_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK30_'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

d &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; row &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;keys&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; cnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{}{:04.0f}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{}{:04.0f}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'''
Results:
xxx_9999TUNK10_0001
xxx_9999TUNK10_0001
xxx_9999TUNK10_0001
xxx_9999BANK12_0002
xxx_9999BANK17_0003
xxx_9999BANK1_0004
xxx_9999BANK20_0005
xxx_9999BANK20_0005
xxx_9999BANK20_0005
xxx_9999BANK30_0006
'''&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the prefixed 'xxx_' always the same, or does it vary?&amp;nbsp; If it varies, you will need to do some string splitting, etc.&lt;/P&gt;&lt;P&gt;Is the postfixed '_' always present?&amp;nbsp; If not, the formatting statement can be modified to include it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By making the dictionary 'd' and the counter 'cnt' global, you should be able to make it work for the field calculator.&amp;nbsp; The code should also work with an update cursor, should you wish to go that route.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:11:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152868#M11806</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T08:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152869#M11807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Prefix is always the same and suffix is always present and varies. Could I&lt;/P&gt;&lt;P&gt;substitute the data portion with the field name?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charles Banks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2018 17:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152869#M11807</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-28T17:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152870#M11808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure I understand your question.&amp;nbsp; Would something like this do what you want?&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'xxx_9999TUNK10_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999TUNK10_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999TUNK10_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK12_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK17_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK1_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK20_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK20_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK20_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'xxx_9999BANK30_'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;


d &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# empty dictionary&lt;/SPAN&gt;
cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# counter&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;seq_count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fname&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; val&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;global&lt;/SPAN&gt; d
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;global&lt;/SPAN&gt; cnt

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; val &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;keys&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;val&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; cnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{}_{}{:04.0f}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fname&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; val&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{}_{}{:04.0f}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fname&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; val&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;val&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


fieldName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'myField'&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; item &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; seq_count&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fieldName&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'''
Results:
myField_xxx_9999TUNK10_0001
myField_xxx_9999TUNK10_0001
myField_xxx_9999TUNK10_0001
myField_xxx_9999BANK12_0002
myField_xxx_9999BANK17_0003
myField_xxx_9999BANK1_0004
myField_xxx_9999BANK20_0005
myField_xxx_9999BANK20_0005
myField_xxx_9999BANK20_0005
myField_xxx_9999BANK30_0006
'''&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:11:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152870#M11808</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T08:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: In this example, how do I write a Python script to accomplish this?</title>
      <link>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152871#M11809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charles Banks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2018 18:18:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/in-this-example-how-do-i-write-a-python-script-to/m-p/152871#M11809</guid>
      <dc:creator>CharlesBanks2</dc:creator>
      <dc:date>2018-06-28T18:18:01Z</dc:date>
    </item>
  </channel>
</rss>

