<?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: Update cursor not replacing values in python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304617#M23658</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the further explanation! The reason why I have to assign row[0] to the row[0].replace object makes complete sense now. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 May 2017 18:03:51 GMT</pubDate>
    <dc:creator>JoshuaBrengel</dc:creator>
    <dc:date>2017-05-27T18:03:51Z</dc:date>
    <item>
      <title>Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304610#M23651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am trying to use an update cursor on an attribute table of a feature class (called Lancowatersheds) in order to replace certain characters in values in a specific field of the table (called STORMWATER). &amp;nbsp;I tried the following code and when I used the print function to show desired changes (remove all "-" and "\" from all values in the STORMWATER field and replace with " "), the update cursor did not seem to work (values still had those funky characters in them):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Import arcpy&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;# Set environments&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; env
env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:/GIS_Data/Test"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Input feature class&lt;/SPAN&gt;
in_fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:/GIS_Data/Test/TEST/Lancowatersheds.shp"&lt;/SPAN&gt; 

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"STORMWATER"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row&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="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"-"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string 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; row&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="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\\"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string 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; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&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; row
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; row
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor

&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a list of all the original values in the STORMWATER field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;['SUSQUEHANNA RIVER', 'PEQUEA CREEK', 'OCTORARO CREEK', 'MILL CREEK', 'LITTLE CONESTOGA CREEK', 'CONOWINGO CREEK', 'CONEWAGO CREEK-DAUPHIN', 'CONESTOGA RIVER', 'COCALICO CREEK', 'CHICKIES CREEK', 'DONEGAL\LOWER CHICKIES CREEK']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then put all the desired values from the "STORMWATER" field into a list (e.g. there should be no weird characters in the values because I ran the update cursor). &amp;nbsp;I wanted to use this list to select certain features from the original shapefile "Lancowatersheds" and make that selection a standalone feature class. &amp;nbsp;Here's that code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;wsheds &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SUSQUEHANNA RIVER'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'PEQUEA CREEK'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OCTORARO CREEK'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'MILL CREEK'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'LITTLE CONESTOGA CREEK'&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;'CONOWINGO CREEK'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CONEWAGO CREEK DAUPHIN'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CONESTOGA RIVER'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'COCALICO CREEK'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CHICKIES CREEK'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'DONEGAL LOWER CHICKIES CREEK'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; shed &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; wsheds&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; whereExp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\"STORMWATER\" = \'{0}\'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;shed&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; whereExp&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'{0:s}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;shed&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&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;/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;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the above code to work for all the objects in the my "wsheds" list whose original values did not contain a "-" or "\" , but for the two objects in the STORMWATER field whose original values contained those characters, no such luck. &amp;nbsp;Maybe automating is a bit much for such a small data set, but I guess my ultimate goal is to understand how to use update cursors to replace any character in a value in any field of an attribute table. &amp;nbsp;I could see this being a useful skill when dealing with much larger data sets. Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:35:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304610#M23651</guid>
      <dc:creator>JoshuaBrengel</dc:creator>
      <dc:date>2021-12-11T14:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304611#M23652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Python strings are immutable, you cannot simply just change the value in your existing row using the replace method on the existing string.&amp;nbsp; You would need to set row[0] to a new string that replaces the values in the old string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;row[0] = row[0].replace("-", " ")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.tutorialspoint.com/python/string_replace.htm"&gt;https://www.tutorialspoint.com/python/string_replace.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, when using a with statement, you do not need to delete your cursor it will close upon completion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 19:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304611#M23652</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2017-05-25T19:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304612#M23653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/calculate-field.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/calculate-field.htm"&gt;Calculate Field—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"STORMWATER"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"""str(!STORMWATER!).replace("-","")"""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"PYTHON_9.3"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 20:04:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304612#M23653</guid>
      <dc:creator>MitchHolley1</dc:creator>
      <dc:date>2017-05-25T20:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304613#M23654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ian! I will have to try this. &amp;nbsp;I'm still a bit confused as to how exactly assigning row[0].replace to row[0] gets around the problem of immutability, but I get the fact that strings are immutable and the replace() method won't work on the strings directly. &amp;nbsp;Unfortunately, I forgot to load my data to my personal laptop and won't be able to try this fix for a few days... Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 23:08:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304613#M23654</guid>
      <dc:creator>JoshuaBrengel</dc:creator>
      <dc:date>2017-05-25T23:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304614#M23655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess I didn't even think about using CalculateField_management. Seems like a good route (though I suppose it has its positives and negatives just like cursors) and will have to keep it in mind. &amp;nbsp;In this case, I'm hoping to use cursors, but never hurts to think about something from another angle! Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 23:12:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304614#M23655</guid>
      <dc:creator>JoshuaBrengel</dc:creator>
      <dc:date>2017-05-25T23:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304615#M23656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the cursor encounters an error, using the &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;with&lt;/SPAN&gt; statement allows for the connections to be cleaned up.&amp;nbsp; If the cursor doesn't run into an error, then using the with statement resets the cursor so it can be iterated over again without using cursor.reset().&amp;nbsp; To remove all of the locks, including schema locks, the cursor still needs to be deleted.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 23:21:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304615#M23656</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-05-25T23:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304616#M23657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;replace&lt;/SPAN&gt; is a Python method and not an ArcPy method, it is good to check the Python documentation:&amp;nbsp; &lt;A href="https://docs.python.org/2/library/stdtypes.html#string-methods"&gt;Python String Methods.&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;CODE class="" style="background-color: transparent; padding: 0px 1px; font-size: 0.95em;"&gt;str.&lt;/CODE&gt;&lt;CODE class="" style="background-color: transparent; padding: 0px 1px; font-size: 1.2em; font-weight: bold;"&gt;replace&lt;/CODE&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;EM&gt;old&lt;/EM&gt;, &lt;EM&gt;new&lt;/EM&gt;&lt;SPAN class="" style="font-size: 1.3em;"&gt;[&lt;/SPAN&gt;, &lt;EM&gt;count&lt;/EM&gt;&lt;SPAN class="" style="font-size: 1.3em;"&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0px; text-align: justify; line-height: 20.8px;"&gt;Return a copy of the string with all occurrences of substring &lt;EM&gt;old&lt;/EM&gt; replaced by &lt;EM&gt;new&lt;/EM&gt;. If the optional argument &lt;EM&gt;count&lt;/EM&gt; is given, only the first &lt;EM&gt;count&lt;/EM&gt; occurrences are replaced.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Regardless of the mutability or immutability of Python strings, the &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;replace&lt;/SPAN&gt; method returns "a copy of the string ...."&amp;nbsp; &lt;EM&gt;The reason &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;replace&lt;/SPAN&gt; returns a copy is because Python strings are immutable, as &lt;A href="https://community.esri.com/migrated-users/42743"&gt;Ian Murray&lt;/A&gt;‌ points out.&amp;nbsp;&lt;/EM&gt; Your original code is generating a copy of the string with the changes you want, but you aren't doing anything with the new string, like reassigning it back to &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;row[0]&lt;/SPAN&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 23:29:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304616#M23657</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-05-25T23:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Update cursor not replacing values in python script</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304617#M23658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the further explanation! The reason why I have to assign row[0] to the row[0].replace object makes complete sense now. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 May 2017 18:03:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-not-replacing-values-in-python/m-p/304617#M23658</guid>
      <dc:creator>JoshuaBrengel</dc:creator>
      <dc:date>2017-05-27T18:03:51Z</dc:date>
    </item>
  </channel>
</rss>

