Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Problems single quotes and variables used in Where Clause

$
0
0
I did not know where else to put this. I have a python list of string variables from an Arc Table I made, some of which contain single quotes in the middle of them. I am trying to have a for loop iterate through use these string values in the Where Clause of a few arcpy tools. The only thing is that in a where clause, since a string value has to to be in single quotes, the single quote in the middle of the string values is throwing an error and messing up the quotations that Arcmap is reading in the Where Clause. Other than having to have an update cursor go through and remove all the quotes from the string values, is there any way to get Arcpy tools with where clauses to work with strings that have a single quotation mark in them? I have already tried escaping it with \ and r', both of which didn't work. Any ideas?

Viewing all articles
Browse latest Browse all 2485

Trending Articles