<?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: Deleting double quotation &amp;quot; in field, find/replace errors - script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499405#M39208</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can see that you are not working through the quote characters in a logical way. You cannot hide the double quote string in the middle of a double quoted string with single quotes. You have to use the wonderful escape character (\).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So your calculate expression must be like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gp.CalculateField_management(fc + "\\Parcels.shp", "!SIT_FULL_S!.replace('\"','')", "PYTHON", "")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Just visually "unpack" the string to see what is happening. Even better make a separate expression string and print it out to see if you get what is expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
expression = "!SIT_FULL_S!.replace('\"','')"
print expression
gp.CalculateField_management(fc + "\\Parcels.shp", expression, "PYTHON", "")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the expression without the backslash would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"!SIT_FULL_S!.replace('"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...followed by a syntax error:&amp;nbsp; ',")" - an unclosed single quote which you don't find because CalculateField does not run TabNanny before it attempts to run it. So it does not compile and "doesn't work". Actually this is picked up by TabNanny. I recommend that you use it in Pythonwin to trap this sort of syntax error. It is the little tick icon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is why it is not a good idea to be sucked into using CalculateField instead of a cursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use a cursor in scripts. Leave CalculateField for Modelbuilder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With a cursor you can pre-check the syntax with TabNanny (I hope you always do that!), you can expand out the steps to make it clearer, you can test for unexpected data and correct it, and you can add a try/except block to trap more unexpected errors without stopping the whole process. you can print out current variables when it crashes to see what the faulty data was.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:56:00 GMT</pubDate>
    <dc:creator>KimOllivier</dc:creator>
    <dc:date>2021-12-11T21:56:00Z</dc:date>
    <item>
      <title>Deleting double quotation &amp;quot; in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499397#M39200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have several shape files (all Parcels.shp) that I run scripts on in an attempt to clean and standardize the address field (SIT_FULL_S).&amp;nbsp; Whenever a record has a double quotation, I get an error and the script shuts down.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I am using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CalculateField_management(fc + "\\Parcels.shp", "SIT_FULL_S", "!SIT_FULL_S!.replace(u'\u0022',u'\u0027')", "PYTHON", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;example 1 - Script works with this text:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 125 South&amp;nbsp; Main Street&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;example 2 - Script shuts down with this text:&amp;nbsp; 125 South "Main Street"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try example 1, the scripts runs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try example 2, the script quits with Error 000539&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Long story short, how can I remove any occurances of " from my field so that I can run my address scrubbing scripts ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or perhaps I should ask how to modify my below script to ignore the " and continue running. Here is an example of one of my address scrubbing scripts and the log showing the error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;gp.CalculateField_management(fc + "\\Parcels.shp","SIT_FULL_S", "!SIT_FULL_S!.lstrip('0')", "PYTHON")&lt;BR /&gt;arcgisscripting.ExecuteError: ERROR 000539: Error running expression: "9030 W SR 2 HWY "A"".lstrip('0') &amp;lt;type 'exceptions.SyntaxError'&amp;gt;: invalid syntax (&amp;lt;string&amp;gt;, line 1)&lt;BR /&gt;Failed to execute (CalculateField).&lt;/STRONG&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jan 2011 21:01:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499397#M39200</guid>
      <dc:creator>TurnerNowak</dc:creator>
      <dc:date>2011-01-12T21:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499398#M39201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well with python you can use a cursor to go over the features and when it finds a " it can take it out. I had to do that recently on one of my feature classes as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 11:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499398#M39201</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2011-01-13T11:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499399#M39202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Well with python you can use a cursor to go over the features and when it finds a " it can take it out. I had to do that recently on one of my feature classes as well.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Great, would you be able to share that with me ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 16:32:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499399#M39202</guid>
      <dc:creator>TurnerNowak</dc:creator>
      <dc:date>2011-01-13T16:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499400#M39203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I just did it in the python window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
cursor=arcpy.UpdateCursor(your feature class)
for feature in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if '"' in feature.YourField: #if a double quote is in the string returned,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.YourField=feature.YourField.replace('"','') #replace that double quote with an empty string (removes it)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.UpdateRow(feature)
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That should work. Let me know if it doesnt.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499400#M39203</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2021-12-11T21:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499401#M39204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think I just did it in the python window.&lt;BR /&gt; &lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
cursor=arcpy.UpdateCursor(your feature class)
for feature in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if '"' in feature.YourField: #if a double quote is in the string returned,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.YourField=feature.YourField.replace('"','') #replace that double quote with an empty string (removes it)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.UpdateRow(feature)
&lt;/PRE&gt;&lt;BR /&gt; &lt;BR /&gt;That should work. Let me know if it doesnt.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could not get that to work so I modified my original replace script but I am getting a EOL error on the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;gp.CalculateField_management(fc + "\\Parcels.shp", "!SIT_FULL_S!.replace('"',''), "PYTHON", "")&lt;/STRONG&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:55:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499401#M39204</guid>
      <dc:creator>TurnerNowak</dc:creator>
      <dc:date>2021-12-11T21:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499402#M39205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;gp.CalculateField_management(fc + "\\Parcels.shp", "!SIT_FULL_S!.replace('"','')", "PYTHON", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looks like you forgot the closing quote on the formula string. Not sure why the cursor didnt work though.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 11:46:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499402#M39205</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2011-01-14T11:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499403#M39206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;gp.CalculateField_management(fc + "\\Parcels.shp", "!SIT_FULL_S!.replace('"','')", "PYTHON", "")&lt;BR /&gt; &lt;BR /&gt;Looks like you forgot the closing quote on the formula string. Not sure why the cursor didnt work though.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yeah, still won't work !&amp;nbsp; I'll give up on that for now. How about modifying the Python script :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;gp.CalculateField_management(fc + "\\Parcels.shp","SIT_FULL_S", "!SIT_FULL_S!.lstrip('0')", "PYTHON")&lt;/STRONG&gt;&lt;SPAN&gt;to ignore all rows that contain a " and continue processing the rest of the table ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had no idea this would stump so many people. Seems like such a basic function..........&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 16:47:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499403#M39206</guid>
      <dc:creator>TurnerNowak</dc:creator>
      <dc:date>2011-01-14T16:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499404#M39207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am running into a similar problem with strings containing double quotes (") when just trying to do a simple calculate field to remove "whitespace" with Python.&amp;nbsp; I would hope there is an elegant solution for dealing with these issues as I would believe they could come up quite regularly.&amp;nbsp; I am using the following code:&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;" ".join(!FIELDA!.split())&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A workaround when the quote never falls on the last character could be ""+!FIELDA+"" which puts the string in triple quotes, this however fails once again if the last character of the string is a double quote.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why does this process not bracket the string automatically with single quotes when double quotes are present or automatically escape the quotes like a .read() would do?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Jan 2011 02:45:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499404#M39207</guid>
      <dc:creator>JasonDeMunck</dc:creator>
      <dc:date>2011-01-16T02:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499405#M39208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can see that you are not working through the quote characters in a logical way. You cannot hide the double quote string in the middle of a double quoted string with single quotes. You have to use the wonderful escape character (\).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So your calculate expression must be like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gp.CalculateField_management(fc + "\\Parcels.shp", "!SIT_FULL_S!.replace('\"','')", "PYTHON", "")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Just visually "unpack" the string to see what is happening. Even better make a separate expression string and print it out to see if you get what is expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
expression = "!SIT_FULL_S!.replace('\"','')"
print expression
gp.CalculateField_management(fc + "\\Parcels.shp", expression, "PYTHON", "")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the expression without the backslash would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"!SIT_FULL_S!.replace('"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...followed by a syntax error:&amp;nbsp; ',")" - an unclosed single quote which you don't find because CalculateField does not run TabNanny before it attempts to run it. So it does not compile and "doesn't work". Actually this is picked up by TabNanny. I recommend that you use it in Pythonwin to trap this sort of syntax error. It is the little tick icon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is why it is not a good idea to be sucked into using CalculateField instead of a cursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use a cursor in scripts. Leave CalculateField for Modelbuilder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With a cursor you can pre-check the syntax with TabNanny (I hope you always do that!), you can expand out the steps to make it clearer, you can test for unexpected data and correct it, and you can add a try/except block to trap more unexpected errors without stopping the whole process. you can print out current variables when it crashes to see what the faulty data was.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:56:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499405#M39208</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2021-12-11T21:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499406#M39209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;BLOCKQUOTE&gt;kimo;69183 wrote:&lt;BR /&gt;So your calculate expression must be like this:&lt;/BLOCKQUOTE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gp.CalculateField_management(fc + "\\Parcels.shp", "!SIT_FULL_S!.replace('\"','')", "PYTHON", "")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the tip Kimo, but the above and all other ways of escaping still don't work.&amp;nbsp; I tried to research how to do a find/replace using a cursor and came up with this script, but I'm getting an Error: 999999 at the the line:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;name = row.GetValue("Name").&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcgisscripting
import logging 
logger = logging.getLogger()

gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = True

gp.Workspace = "C:\ZP4"
fcs = gp.ListWorkspaces("*","Folder")

for fc in fcs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = gp.UpdateCursor("//Parcels.shp")
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = row.GetValue("Name")&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; dash = string.find(name, "-")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if dash != -1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fix = name.replace("-", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, rows &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:56:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499406#M39209</guid>
      <dc:creator>TurnerNowak</dc:creator>
      <dc:date>2021-12-11T21:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499407#M39210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Couple of things.&amp;nbsp; One method I use for this is...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
gp.CalculateField_management(fc + "\\Parcels.shp", '"%s" % (!SIT_FULL_S!.replace('"','')'), "PYTHON", "")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding the code and your error.&amp;nbsp; The 999999 is very generic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking at this code, I don't see how it could possibly work as intended.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why are you looping through all the objects in ListWorkspaces() and then doing rows = gp.UpdateCursor("//Parcels.shp")?&amp;nbsp; Aren't you just reopening the same shape file? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Couldn't you just do? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rows = gp.UpdateCursor("//Parcels.shp")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.name = row.GetValue("Name").replace("-", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
del row
del rows
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcgisscripting
import logging 
logger = logging.getLogger()

gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = True

gp.Workspace = "C:\ZP4"
fcs = gp.ListWorkspaces("*","Folder")

for fc in fcs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = gp.UpdateCursor("//Parcels.shp")
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = row.GetValue("Name")&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; dash = string.find(name, "-")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if dash != -1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fix = name.replace("-", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, rows
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:56:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499407#M39210</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T21:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499408#M39211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the suggestions Huey.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try your calculate field script I get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;C:\Documents and Settings\Andrew&amp;gt;"C:\Python24\New Text Document.py"&lt;BR /&gt;&amp;nbsp; File "C:\Python24\New Text Document.py", line 19&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management(fc + "\\Parcels.shp", '"%s" % (!SIT_FULL_S!.rep&lt;BR /&gt;lace('"','')'), "PYTHON", "")&lt;BR /&gt;&lt;BR /&gt;&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; ^&lt;BR /&gt;SyntaxError: invalid syntax&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And when I try your update cursor script I get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;C:\Documents and Settings\Andrew&amp;gt;"C:\Python24\update cursor test.py"&lt;BR /&gt;C:\ZP4\TEST2&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "C:\Python24\update cursor test.py", line 15, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:&lt;BR /&gt;TypeError: 'geoprocessing cursor object' object is not iterable&lt;/STRONG&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jan 2011 16:00:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499408#M39211</guid>
      <dc:creator>TurnerNowak</dc:creator>
      <dc:date>2011-01-21T16:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499409#M39212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The "for row in rows" syntax was introduced with arcpy in ArcGIS 10. For 9.3 and earlier you'll need to use the following construct:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
row = rows.Next()
while row:
&amp;nbsp;&amp;nbsp; &amp;lt;do stuff&amp;gt;
&amp;nbsp;&amp;nbsp; row = rows.Next()
del row, rows
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:56:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499409#M39212</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2021-12-11T21:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499410#M39213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks &lt;/SPAN&gt;&lt;STRONG&gt;lpugh01&lt;/STRONG&gt;&lt;SPAN&gt; , I made those changes and modified a few other lines to come up with a script that works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I have now :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcgisscripting
import logging 
logger = logging.getLogger()

gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = True

gp.Workspace = "C:\ZP4"
fcs = gp.ListWorkspaces("*","Folder")

for fc in fcs:

&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = gp.UpdateCursor(fc + "//Parcels.shp")
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name = row.GetValue('APN').replace('"', '')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print Name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.SetValue('Apn', Name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; del row
&amp;nbsp;&amp;nbsp;&amp;nbsp; del rows


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:56:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499410#M39213</guid>
      <dc:creator>TurnerNowak</dc:creator>
      <dc:date>2021-12-11T21:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting double quotation " in field, find/replace errors - script</title>
      <link>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499411#M39214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;From the code suggestions in this thread (credit all who shared) I put together a model tool that you can use straight up with python code blocks to calculate fields when you have double quotes in a field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 21:01:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-double-quotation-amp-quot-in-field-find/m-p/499411#M39214</guid>
      <dc:creator>PaulBrandt</dc:creator>
      <dc:date>2011-05-06T21:01:44Z</dc:date>
    </item>
  </channel>
</rss>

