>>> '"STATE_NAME"=\'Illinois\' or '"STATE_NAME"=\'Indiana\'' SyntaxError: unexpected character after line continuation character >>>
>>> ' "STATE_NAME"=\'Illinois\' or "STATE_NAME"=\'Indiana\' ' ' "STATE_NAME"=\'Illinois\' or "STATE_NAME"=\'Indiana\' ' >>>
query = ''' "STATE_NAME" IN ('Illinois', 'Indiana') '''
>>> query = '\"STATE_NAME\"=\'Illinois\' or \'\"STATE_NAME\"=\'Indiana\'' >>> print query "STATE_NAME"='Illinois' or '"STATE_NAME"='Indiana'
>>> query = '{0} IN ({1}, {2})'.format('"STATE_NAME"', "'Indiana'", "'Illinois'") >>> print query "STATE_NAME" IN ('Indiana', 'Illinois')
arcpy.SelectLayerByAttribute_management('mwstates','NEW_SELECTION',query)
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.