Hello
How do I handle ' in an attribute table using python?
Example
var = ["'Name"]
any help is greatly appreciated!
Cheers
Chris
I'd just use a backslash as an escape character, that way it doesn't try doesn't crash since there isn't a second single quote to end the string.
var = ["\'Name"]
Generally it not advisable to have special characters in field names, or to have them start with numbers.
Thanks for the idea!
Working code below:
var = ["'\'Name"]
I avoid escape characters by using triple quotes. It is so much easier and more legible. Except when it is the first character when it is a bit hard to see.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.