<?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: String from index position in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499020#M39181</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Matt,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;position is a long, new label field and textstring are string fields... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;!TEXTSTRING![:int( !position!)]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;received:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;error 000539: exceptions.TypeError: cannot concatenate 'str' and 'int' objects.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Mar 2014 13:18:46 GMT</pubDate>
    <dc:creator>NoahHuntington</dc:creator>
    <dc:date>2014-03-04T13:18:46Z</dc:date>
    <item>
      <title>String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499008#M39169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Trying to calculate field using all the leftmost characters of [TEXTSTRING] up to the first occurrence of "out" in [TEXTSTRING] whose position has been calculated and placed in [POSITION] field.&amp;nbsp; The following is&amp;nbsp; vbscript but I'm sure there is an easy python solution to this. The script should help clarify...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[position] = first occurrence of "out" in [TEXTSTRING]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;label:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Left( [TEXTSTRING], Len( [TEXTSTRING] ) [position] )
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this make sense?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2014 20:18:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499008#M39169</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-03-03T20:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499009#M39170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If using field calculator try this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;!TEXTSTRING![:int(!position!)]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;int() may or may not be required depending on field type of "position"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2014 20:35:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499009#M39170</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-03T20:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499010#M39171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you mean splitting it up by white space and finding where the word 'out' is within a string?&amp;nbsp; If so, you could get the position with something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; a = 'this is out at pos 2'
&amp;gt;&amp;gt;&amp;gt; b = 'out at pos 0'
&amp;gt;&amp;gt;&amp;gt; c = 'pos 3 is out'
&amp;gt;&amp;gt;&amp;gt; def findIndex(string, word):
 return string.split().index(word)

&amp;gt;&amp;gt;&amp;gt; for test in [a, b, c]:
 print findIndex(test, 'out')

 
2
0
3
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know much VB so I'm not sure what you're doing once you have the index?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; Matt's answer is waaaay better than mine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499010#M39171</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T21:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499011#M39172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If using field calculator try this.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;!TEXTSTRING![:int(!position!)]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;int() may or may not be required depending on field type of "position"&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried both of the following?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;!TEXTSTRING![: !postion!]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;!TEXTSTRING![: int(!postion!)]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2014 20:41:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499011#M39172</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-03-03T20:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499012#M39173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are just looking to get everything before the word "out" in a text string, how about:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
!TEXTSTRING!.split("out")[0].strip()
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499012#M39173</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T21:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499013#M39174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Do you mean splitting it up by white space and finding where the word 'out' is within a string?&amp;nbsp; If so, you could get the position with something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; a = 'this is out at pos 2'
&amp;gt;&amp;gt;&amp;gt; b = 'out at pos 0'
&amp;gt;&amp;gt;&amp;gt; c = 'pos 3 is out'
&amp;gt;&amp;gt;&amp;gt; def findIndex(string, word):
 return string.split().index(word)

&amp;gt;&amp;gt;&amp;gt; for test in [a, b, c]:
 print findIndex(test, 'out')

 
2
0
3
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I don't know much VB so I'm not sure what you're doing once you have the index?&lt;BR /&gt;&lt;BR /&gt;EDIT:&amp;nbsp; Matt's answer is waaaay better than mine.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No problem. Yeah I'm not sure what your testing in this one?&amp;nbsp; Thanks for chiming in Caleb!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499013#M39174</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2021-12-11T21:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499014#M39175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you are just looking to get everything before the word "out" in a text string, how about:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
!TEXTSTRING!.split("out")[0].strip()
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No luck here?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499014#M39175</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2021-12-11T21:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499015#M39176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could you post a sample of your table you are trying to calculate and the applicable field types?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2014 20:57:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499015#M39176</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-03T20:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499016#M39177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Could you post a sample of your table you are trying to calculate and the applicable field types?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Matt &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See attached:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;label using textstring only...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;label does not all show in table fyi.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2014 21:05:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499016#M39177</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-03-03T21:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499017#M39178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you trying to calculate a field or create a label?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2014 21:30:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499017#M39178</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-03T21:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499018#M39179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Are you trying to calculate a field or create a label?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ultimately label.&amp;nbsp; In doing so was attempting to create new label field? Open to label expression too!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 12:35:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499018#M39179</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-03-04T12:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499019#M39180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If neither of the posted samples worked for you something odd is going on with your data or how you are executing the calculator. Are you sure you are enabling Python instead of VB? What errors or messages do you get?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 13:11:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499019#M39180</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-04T13:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499020#M39181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Matt,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;position is a long, new label field and textstring are string fields... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;!TEXTSTRING![:int( !position!)]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;received:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;error 000539: exceptions.TypeError: cannot concatenate 'str' and 'int' objects.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 13:18:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499020#M39181</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-03-04T13:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499021#M39182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is that your entire expression? Can you take a screenshot of your field calculator window with the code you execute that returns that error? Also can you post the entire error message? And what version of ArcGIS are you using? Something isn't adding up here.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 14:49:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499021#M39182</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-04T14:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499022#M39183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31928[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I'm attempting?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 17:18:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499022#M39183</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-03-04T17:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499025#M39186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
ERROR 000539: SyntaxError: EOL while scanning string literal (&amp;lt;expression&amp;gt;, line 1)
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That is an error with the expression format itself. Double check your field names and that you are using Python instead of VB.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499025#M39186</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T21:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499026#M39187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;That is an error with the expression format itself. Double check your field names and that you are using Python instead of VB.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I ran yesterday according to the picture provided at 11:18 where do you suppose I went wrong? FYI: [postion] although misspelled is the actual field name...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 12:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499026#M39187</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2014-03-05T12:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499023#M39184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you post the full error you are receiving so we can see what has been passed that causes the error? It should look something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Executing: CalculateField blocks TEST_LABEL "!SOURCEID![:&amp;nbsp; !TEXT_INTS! ]" PYTHON_9.3 #
Start Time: Tue Mar 04 12:48:53 2014
ERROR 000539: Error running expression: u"FA07908426251"[:&amp;nbsp; u"2014" ] 
Traceback (most recent call last):
&amp;nbsp; File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;
TypeError: slice indices must be integers or None or have an __index__ method

Failed to execute (CalculateField).
Failed at Tue Mar 04 12:48:53 2014 (Elapsed Time: 0.04 seconds)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can find it under the 'Results' tab&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499023#M39184</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T21:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: String from index position</title>
      <link>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499024#M39185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Can you post the full error you are receiving so we can see what has been passed that causes the error? It should look something like this.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Executing: CalculateField blocks TEST_LABEL "!SOURCEID![:&amp;nbsp; !TEXT_INTS! ]" PYTHON_9.3 #
Start Time: Tue Mar 04 12:48:53 2014
ERROR 000539: Error running expression: u"FA07908426251"[:&amp;nbsp; u"2014" ] 
Traceback (most recent call last):
&amp;nbsp; File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;
TypeError: slice indices must be integers or None or have an __index__ method

Failed to execute (CalculateField).
Failed at Tue Mar 04 12:48:53 2014 (Elapsed Time: 0.04 seconds)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;You can find it under the 'Results' tab&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Messages
Executing: CalculateField OWNERSHIP_TEXT Label "!TEXTSTRING![:int (!postion!)]" PYTHON_9.3 #
Start Time: Tue Mar 04 16:55:32 2014
ERROR 000539: SyntaxError: EOL while scanning string literal (&amp;lt;expression&amp;gt;, line 1)
Failed to execute (CalculateField).
Failed at Tue Mar 04 16:55:32 2014 (Elapsed Time: 0.10 seconds)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-from-index-position/m-p/499024#M39185</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2021-12-11T21:55:28Z</dc:date>
    </item>
  </channel>
</rss>

