<?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: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555963#M43437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;...right, Python thinks you want variable substitution...number of different ways to handle this, but try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'"TEST" LIKE \'%ha%\''&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 May 2013 14:56:16 GMT</pubDate>
    <dc:creator>T__WayneWhitley</dc:creator>
    <dc:date>2013-05-24T14:56:16Z</dc:date>
    <item>
      <title>I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VALUE</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555951#M43425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VALUE I.E "FIGURINE" , I WANT TO EXTRACT LETTER "F" &amp;amp; "R" TO FORM "FR". PLEASE HELP ME&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 20:57:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555951#M43425</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-23T20:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555952#M43426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;strings are iterable, so the first index will be the first letter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then I get the total number of characters, divide by two, and extract that one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; string = "FIGURINE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; string[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'F'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; string[len(string)/2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'R'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; string[0] + string[len(string)/2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'FR'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 22:56:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555952#M43426</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-05-23T22:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555953#M43427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"Field calculator expresion might look like:".upper() &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;arcpy.CalculateField_management(myFC,"NEW_FIELD","!OLD_FIELD![0] + !OLD_FIELD![len(!OLD_FIELD!)/2]","PYTHON_9.3","")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 23:24:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555953#M43427</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-05-23T23:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555954#M43428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;"Field calculator expresion might look like:".upper()&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Haha- Too funny! There needs to be a "Like" button for situations like this...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 00:00:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555954#M43428</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-05-24T00:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555955#M43429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a bunch, csny490 &amp;amp; rzufelt&amp;nbsp;&amp;nbsp; your suggestions worked perfectly for me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 12:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555955#M43429</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-24T12:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555956#M43430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have alot of annotation text attributes imported from AutoCAD, i want to delete all the annotations like the following;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{\fArial|b0|i0|c0|p34;14.50m}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{\fArial|b0|i0|c0|p34;\L0.0203 ha}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{\fArial|b0|i0|c0|p34;161°&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34'}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{\fArial|b0|i0|c0|p34;93°&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10'}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and i want to delete the values such as this {\fArial|b1|i0|c0|p34;} and leave 426 for the ones that appear like this {\fArial|b1|i0|c0|p34;426} and the same for {\fArial|b0|i0|c0|p34;KAF 8816}, i want to delete {\fArial|b0|i0|c0|p34;} and leave KAF 8816.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please do you have any suggestions. Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 12:48:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555956#M43430</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-24T12:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555957#M43431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You mean something like this?:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; text = ['{\fArial|b0|i0|c0|p34;14.50m}',
 '{\fArial|b0|i0|c0|p34;\L0.0203 ha}',
 '{\fArial|b0|i0|c0|p34;161° 34}',
 '{\fArial|b0|i0|c0|p34;93° 10}']
&amp;gt;&amp;gt;&amp;gt; for anno in text:
 anno.split(';')[1]

 
'14.50m}'
'\\L0.0203 ha}'
'161\xb0 34}'
'93\xb0 10}'
&amp;gt;&amp;gt;&amp;gt; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...ah, but think you want to get rid of the last bracket character too -- use the combo 'split' and string slicing py methods:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; for anno in text:
 anno.split(';')[1][0:-1]

 
'14.50m'
'\\L0.0203 ha'
'161\xb0 34'
'93\xb0 10'
&amp;gt;&amp;gt;&amp;gt; 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:00:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555957#M43431</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-12T00:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555958#M43432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to delete all the first set of annotations i.e &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{\fArial|b0|i0|c0|p34;14.50m}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {\fArial|b0|i0|c0|p34;\L0.0203 ha}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {\fArial|b0|i0|c0|p34;161° 34'}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {\fArial|b0|i0|c0|p34;93° 10'}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and for these ones, I want to remove the unwanted characters and keep the ones I need i.e delete the values such as this {\fArial|b1|i0|c0|p34;} and leave 426 &amp;amp; the same for {\fArial|b0|i0|c0|p34;KAF 8816}, i want to delete {\fArial|b0|i0|c0|p34;} and leave KAF 8816, something of this nature.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 13:40:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555958#M43432</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-24T13:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555959#M43433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, there must be a way to select the annos to be deleted?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As for the portion you want to keep, following Rhett's example above, you could apply the split/slice technique I already demonstrated.&amp;nbsp; I was just using your sample text in a list....you can apply it also as Chris suggested in a Python field calculation - in this bare-bones example, say you want to keep '14.50m':&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; text = '{\x0cArial|b0|i0|c0|p34;14.50m}'
&amp;gt;&amp;gt;&amp;gt; text.split(';')[1][0:-1]
'14.50m'
&amp;gt;&amp;gt;&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's not the only way to do it, but fair enough... looks like your bigger challenge will be the means to eliminate the anno you want to keep.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(er, I mean, eliminate the anno you &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;don't&lt;/SPAN&gt;&lt;SPAN&gt; want to keep.)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:00:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555959#M43433</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-12T00:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555960#M43434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to use an sql expression like this: "TEXTSTRING" LIKE '%fArial|b0|i0|c0|p34%' to remove all the annotations like that, then delete the values such as this {\fArial|b1|i0|c0|p34;} and leave 426 for the ones that appear like this {\fArial|b1|i0|c0|p34;426} and the same for {\fArial|b0|i0|c0|p34;KAF 8816}, i want to delete {\fArial|b0|i0|c0|p34;} and leave KAF 8816.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 14:14:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555960#M43434</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-24T14:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555961#M43435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So have you already got this in a format you can read in ArcMap?...if so, have you tested that query to select the records you want to delete?&amp;nbsp; I'm not sure what you are saying, are you stuck somewhere in this process?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that query works, i.e., you've opened the attribute table and switched selection (or used 'not like' in your query) and satisfactorily confirmed this is what you want to keep, then execute the delete process.&amp;nbsp; On the remaining set, then execute the calculate field process, as in the following (I didn't test it, but will follow Chris example, which looks good to me):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CalculateField_management(myFC,"NEW_FIELD","!OLD_FIELD!.split(';')[1][0:-1]","PYTHON_9.3","")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;....make the necessary adjustments in field calculator syntax; essentially this is the operative Python syntax to 'extract' your text:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.split(';')[1][0:-1]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 14:27:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555961#M43435</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-05-24T14:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555962#M43436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please how do I compose this arcpy script to select any text that has "ha", I tried the script below and that is the error message I got. Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.SelectLayerByAttribute_management("HTNT_Annoss", "NEW_SELECTION",'"TEST" LIKE '%ha%'')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NameError: name 'ha' is not defined&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 14:41:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555962#M43436</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-24T14:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555963#M43437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;...right, Python thinks you want variable substitution...number of different ways to handle this, but try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'"TEST" LIKE \'%ha%\''&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 14:56:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555963#M43437</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-05-24T14:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555964#M43438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Y'all I got the SQL Expression eventually;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management("Annos", "ADD_TO_SELECTION",'"TEXTS" LIKE \'%m%\'')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a bunch!!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please how can i handle the issue of schema Lock? This schema lock issue is really getting on my nerves.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 22:25:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555964#M43438</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-24T22:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555965#M43439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, I guess the shortest answer to combat schema locks is not to have the dataset (the feature class) open in another application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Things like adding a field I think will require what is called an 'exclusive' lock; other operations may allow what is known as a 'shared' lock.&amp;nbsp; However, it is safe not to allow anything to remain open or any other users accessing your data if you're trying to edit it.&amp;nbsp; (or, if you must allow other users, you may work with versioning, distributed editing, etc.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, if you have done something like open a cursor and you're done with it, that is an object reference you can delete - not sure if that always works in a timely fashion, but it helps to remember if you've opened any object for read/write purposes that it can 'lock' it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps.&amp;nbsp; Is something or some part of your procedure causing the locking of your dataset?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 22:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555965#M43439</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-05-24T22:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555966#M43440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please which symbol can I use to represent the degree (°) and minute (') symbol in my python scripts, because each time I try to run my script I get this error message for the line containing the 2 symbols mentioned earlier;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;\line 32, but no encoding declared; see &lt;/SPAN&gt;&lt;A href="http://www.python.org/peps/pep-0263.html"&gt;http://www.python.org/peps/pep-0263.html&lt;/A&gt;&lt;SPAN&gt; for details&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 May 2013 11:41:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555966#M43440</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-26T11:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555967#M43441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How can i split the text for the ones like this \pt16.25;{\fArial|b0|i0|c0|p34;15.00m} (they have 2 &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; and the script ive been using is like this &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CalculateField_management("Annos","TEXTS","!TEXTSTRING!.split(';')[1][0:-1]","PYTHON_9.3","")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please help me&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 May 2013 15:26:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555967#M43441</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2013-05-26T15:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555968#M43442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can use regular expressions to take out the control codes in one fell swoop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import re

def remove_codes(code_string):
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get rid of enclosed text, ie {\instruction;Text to keep}
&amp;nbsp;&amp;nbsp;&amp;nbsp; replaced_sequences = re.sub(r"{\\[^;]+;([^}]*)}", r"\1", code_string)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get rid of standalone \font|22pt; like sequences
&amp;nbsp;&amp;nbsp;&amp;nbsp; new_string = re.sub(r"\\[^;]+;", "", replaced_sequences)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return new_string&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And this gives us&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; remove_codes(r"\pt16.25;{\fArial|b0|i0|c0|p34;15.00m}")
'15.00m'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in the Python window&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:00:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555968#M43442</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-12T00:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555969#M43443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks jscheirer I tried to insert your code into my script and this was the error message I got;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.CalculateField_management("Annos","TEXTS","!TEXTSTRING!.remove_codes","PYTHON_9.3","")
Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 3128, in CalculateField&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError: ERROR 000539: Error running expression: "{\fArial|b0|i0|c0|p34;C - 40}".remove_codes&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt; AttributeError: 'str' object has no attribute 'remove_codes'&amp;nbsp; Failed to execute (CalculateField).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please what do you think I can do?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:01:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555969#M43443</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2021-12-12T00:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: I NEED TO EXTRACT THE FIRST LETTER AND THE MIDDLE LETTER OF A STRING ATTRIBUTE VA</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555970#M43444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You put that part with the import and def in the code block and change the expression to remove_codes(!TEXTSTRING!)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 May 2013 10:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-extract-the-first-letter-and-the-middle/m-p/555970#M43444</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2013-05-27T10:48:43Z</dc:date>
    </item>
  </channel>
</rss>

