簡體   English   中英

Python-刪除雙引號“以使腳本運行

[英]Python - removing double quotation marks " so that script runs

我正在使用Python腳本來編輯許多形狀文件的表。 以下腳本可以正常運行,但是如果SIT_FULL_S字段中有任何“”標記,則腳本將錯誤並關閉。

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).

我有兩個選擇,創建一個貫穿並刪除所有出現的“”的新腳本,然后運行上面的腳本或修改上面的腳本以忽略“”並繼續運行。

有人可以幫忙嗎?

逃脫它:

"string \"inner string\""

或不要混用引號:

'string "inner string"'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM