<?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: Python: If Then with Left Equivalent in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620558#M48337</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;API_10[0:2]&lt;/SPAN&gt; or &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;API_10[:2]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Oct 2017 15:06:36 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2017-10-24T15:06:36Z</dc:date>
    <item>
      <title>Python: If Then with Left Equivalent</title>
      <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620557#M48336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="Codeblock" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/381199_Capture.JPG" style="height: auto;" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Trying to calculate using Python in 10.3 the "Region" field with text based on the first two characters in a string field called "API_10".&amp;nbsp; Basically, if the left two characters in "API_10"&amp;nbsp;equal "33", then populate "Region" with "North".&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 14:35:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620557#M48336</guid>
      <dc:creator>MichaelWalden</dc:creator>
      <dc:date>2017-10-24T14:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python: If Then with Left Equivalent</title>
      <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620558#M48337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;API_10[0:2]&lt;/SPAN&gt; or &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;API_10[:2]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 15:06:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620558#M48337</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-10-24T15:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Python: If Then with Left Equivalent</title>
      <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620559#M48338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua is correct... python slicing is 0 based and exclusive of the slice number, hence&lt;/P&gt;&lt;P&gt;whatever[:2] or whatever[0:2] will return 0 and 1.&amp;nbsp; The slice is [start:stop:step]&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;whatever &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'abcdefg'&lt;/SPAN&gt;

whatever&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;6&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'ace'&lt;/SPAN&gt;

whatever&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;6&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'ace'&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or skipping the start and stop&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;whatever&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;6&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'abcdef'&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:29:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620559#M48338</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T02:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python: If Then with Left Equivalent</title>
      <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620560#M48339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, just pass the whole column to your function since the function does slicing and checking:&amp;nbsp;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; Region = TextValue(!API_10!)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 15:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620560#M48339</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-10-24T15:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python: If Then with Left Equivalent</title>
      <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620561#M48340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you do a slice or substring in Python and&amp;nbsp; it starts with "0" then the second number is always the length.&amp;nbsp; This confused me for a while .....&amp;nbsp;&lt;A class="link-titled" href="https://www.dotnetperls.com/substring-python" title="https://www.dotnetperls.com/substring-python"&gt;https://www.dotnetperls.com/substring-python&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/381284_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 15:24:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620561#M48340</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2017-10-24T15:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python: If Then with Left Equivalent</title>
      <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620562#M48341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or the most succinct descriptor..&lt;A href="https://docs.python.org/3.6/library/functions.html#slice"&gt;&lt;STRONG&gt;. the python docs&amp;nbsp;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 15:30:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620562#M48341</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-10-24T15:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python: If Then with Left Equivalent</title>
      <link>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620563#M48342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joshua!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 16:15:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-if-then-with-left-equivalent/m-p/620563#M48342</guid>
      <dc:creator>MichaelWalden</dc:creator>
      <dc:date>2017-10-24T16:15:24Z</dc:date>
    </item>
  </channel>
</rss>

