jdrvar;329266 wrote:
I changed the text to match my field name. My field name is TextString. So, my line of script reads:
"(" + !TextString! + ")"QUOTE] addParentheses = "(" + !TextString! + ")" returns a Syntax Error. I know the field name and type are correct, therefore, believed the expression to be correct. That left the concatenation of parentheses. But, the concatenation worked within Field Calculator. Then, I went back reread the posts and tried adding a second variable; expression = (!TextString!). Which also created a Syntax Error. So, I removed the exclamation points from the addParentheses variable. Removing the exclamation points, the script runs, and replaces existing text with parentheses. But, I want to concatenate the existing text with parentheses. Any suggestions?
TextString = arcpy.GetParameterAsText(0)
addParentheses = "(" + TextString + ")"
cursor = arcpy.da.UpdateCursor(History, ["TextString"])
for row in cursor:
row[0] = addParentheses
cursor.updateRow(row)
del row
del cursor