Python - removing double quotation marks " so that script runs

Posted by andrew k on Stack Overflow See other posts from Stack Overflow or by andrew k
Published on 2011-01-13T00:46:24Z Indexed on 2011/01/13 0:53 UTC
Read the original article Hit count: 215

Filed under:
|

I am using Python scripts to edit the table of many shape files. The following script runs fine, but if there are any " marks in the SIT_FULL_S field, the script errors and shuts down.

gp.CalculateField_management(fc + "\\Parcels.shp","SIT_FULL_S", "!SIT_FULL_S!.lstrip('0')", "PYTHON")
arcgisscripting.ExecuteError: ERROR 000539: Error running expression: "9030 W SR 2 HWY "A"".lstrip('0') <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 1)
Failed to execute (CalculateField).

I have two options, create a new script that runs through and deletes all occurances of ", and then run the above script or modify the above script to ignore the " and contiue running.

Can anyone help ?

© Stack Overflow or respective owner

Related posts about python

Related posts about arcmap