<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Selecting records from feature class that have special characters using a dictionary (python) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203372#M15624</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "fc" is an already existing layer and the intent was to use this bit of code in both pro and desktop within different scripts I am creating. But in desktop creating a select by attributes statement requires the double quote instead of single quote (EX: 'Prince George's' ----&amp;gt; 'Prince George"s').&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Jul 2019 16:15:15 GMT</pubDate>
    <dc:creator>LuisResh</dc:creator>
    <dc:date>2019-07-26T16:15:15Z</dc:date>
    <item>
      <title>Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203366#M15618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having trouble selecting counties that have single quotes and/or periods in their name with python that are stored in a dictionary. The below code I have works on county records with no special characters but does not with the special character counties. Any advice/suggestions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;fc = "Maryland_County_Boundaries"&lt;BR /&gt;CountyDict = {&lt;BR /&gt; "Allegany": "Allegany",&lt;BR /&gt; "Anne Arundel": "Anne Arundel",&lt;BR /&gt; "Baltimore": "Baltimore",&lt;BR /&gt; "Calvert": "Calvert",&lt;BR /&gt; "Caroline": "Caroline",&lt;BR /&gt; "Carroll": "Carroll",&lt;BR /&gt; "Cecil": "Cecil",&lt;BR /&gt; "Charles": "Charles",&lt;BR /&gt; "Dorchester": "Dorchester",&lt;BR /&gt; "Frederick": "Frederick",&lt;BR /&gt; "Garrett": "Garrett",&lt;BR /&gt; "Harford": "Harford",&lt;BR /&gt; "Howard": "Howard",&lt;BR /&gt; "Kent": "Kent",&lt;BR /&gt; "Montgomery": "Montgomery",&lt;BR /&gt; "Prince George\'s": "Prince George\"s",&lt;BR /&gt; "Queen Anne\'s": "Queen Anne\"s",&lt;BR /&gt; "St. Mary\'s": "St. Mary\"s",&lt;BR /&gt; "Somerset": "Somerset",&lt;BR /&gt; "Talbot": "Talbot",&lt;BR /&gt; "Washington": "Washington",&lt;BR /&gt; "Wicomico": "Wicomico",&lt;BR /&gt; "Worcester": "Worcester"&lt;BR /&gt; }&lt;BR /&gt;for k,v in CountyDict.items():&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if k == "Prince George's":&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qry = '"' + "COUNTY" + '"' + " IN ('{}')".format(v)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(fc, 'NEW_SELECTION',qry)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is attachment of attribute field with county names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 13:34:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203366#M15618</guid>
      <dc:creator>LuisResh</dc:creator>
      <dc:date>2019-07-26T13:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203367#M15619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, are you converting your 'fc' into a &lt;A href="http://desktop.arcgis.com/en/arcmap/10.6/tools/data-management-toolbox/make-feature-layer.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Feature Layer&lt;/A&gt;?&amp;nbsp; Most of my python is executed as a stand alone script, so I do that by default. To make a selection on a feature class, you need to MakeFeatureLayer...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've used something like this to find special characters in in street names:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import string
from string import punctuation
from string import ascii_letters
temptable = "tableinmemory"
fields = ["StreetName","OBJECTID"]
badstring = []
with arcpy.da.SearchCursor("view",fields) as cursor:
    for row in cursor:
        name = row[0]
        if any(char in string.punctuation for char in name):
            badstring.append(int(row[1]))  #get a list of violators oid&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This particular snippet creates a list of object ids which you could then loop through in a selection block.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:06:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203367#M15619</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T10:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203368#M15620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/4422"&gt;Joe Borgione&lt;/A&gt;‌, with ArcGIS Pro, the Select Layer By ... tools accept data sets directly and will return a feature layer.&amp;nbsp; This is a behavior change from ArcMap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 15:50:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203368#M15620</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-07-26T15:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203369#M15621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the county names really using double quotes, e.g., &lt;CODE&gt;Prince George"s &lt;/CODE&gt;?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 15:54:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203369#M15621</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-07-26T15:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203370#M15622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good to know!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:08:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203370#M15622</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-07-26T16:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203371#M15623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you want something that would escape the single quote&amp;nbsp;for a query?&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; d &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Prince George's"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Prince George\\'s"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Prince George's"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
Prince George\'s
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"COUNTY = '{}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;d&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Prince George's"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; query
COUNTY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Prince George\'s'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:06:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203371#M15623</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T10:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203372#M15624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "fc" is an already existing layer and the intent was to use this bit of code in both pro and desktop within different scripts I am creating. But in desktop creating a select by attributes statement requires the double quote instead of single quote (EX: 'Prince George's' ----&amp;gt; 'Prince George"s').&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:15:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203372#M15624</guid>
      <dc:creator>LuisResh</dc:creator>
      <dc:date>2019-07-26T16:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203373#M15625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The intended use is to take a user input of a single or many county name, one name(s) listed in the above attachment image, and tell the script to run a select by attribute of those&amp;nbsp;specified and&amp;nbsp;in later code extract specific assets by the selected county or counties. The problem is the statement returns an error whenever the name selected counties are the ones with single quotes and/or period (St. Mary's, Queen Anne's, Prince George's)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:29:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203373#M15625</guid>
      <dc:creator>LuisResh</dc:creator>
      <dc:date>2019-07-26T16:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203374#M15626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even after the script runs nothing happens? No error is thrown and the statement matches exactly what is used when I manually do the select by attribute tool in desktop. Below are snippets of a manual selection working but the python code not. &lt;SPAN&gt;The query from the code is also printed to show end result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/454508_pastedImage_1.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/454509_pastedImage_2.jpg" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:36:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203374#M15626</guid>
      <dc:creator>LuisResh</dc:creator>
      <dc:date>2019-07-26T16:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203375#M15627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Luis, have you tried saving a snippet that works manually, then load the '*.cal' file in a text editor and check to see what format is used?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:40:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203375#M15627</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-07-26T16:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203376#M15628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What you are seeing in the GUI isn't a double quote but two single quotes.&amp;nbsp; It isn't a Python thing, but a SQL thing, i.e., in SQL you use a double single quote to escape a single quote.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:56:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203376#M15628</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-07-26T16:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203377#M15629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;county &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Prince George's"&lt;/SPAN&gt;
query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"COUNTY = '{}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;county&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\\'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; query
&lt;SPAN class="comment token"&gt;# COUNTY = 'Prince George\'s'&lt;/SPAN&gt;

county &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Prince George's"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Queen Anne's"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"COUNTY IN ('{}')"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"', '"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\\'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; county&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; query
&lt;SPAN class="comment token"&gt;# COUNTY IN ('Prince George\'s', 'Queen Anne\'s')&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:06:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203377#M15629</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T10:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting records from feature class that have special characters using a dictionary (python)</title>
      <link>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203378#M15630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes that worked! So in dictionary, for example Prince George's, I changed item to&amp;nbsp;"Prince George\'s": "Prince George\'\'s" and it worked. T&lt;STRONG&gt;hank you all for your help! Updated code below.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;fc = "Maryland_County_Boundaries"&lt;BR /&gt;CountyDict = {&lt;BR /&gt; "Allegany": "Allegany",&lt;BR /&gt; "Anne Arundel": "Anne Arundel",&lt;BR /&gt; "Baltimore": "Baltimore",&lt;BR /&gt; "Calvert": "Calvert",&lt;BR /&gt; "Caroline": "Caroline",&lt;BR /&gt; "Carroll": "Carroll",&lt;BR /&gt; "Cecil": "Cecil",&lt;BR /&gt; "Charles": "Charles",&lt;BR /&gt; "Dorchester": "Dorchester",&lt;BR /&gt; "Frederick": "Frederick",&lt;BR /&gt; "Garrett": "Garrett",&lt;BR /&gt; "Harford": "Harford",&lt;BR /&gt; "Howard": "Howard",&lt;BR /&gt; "Kent": "Kent",&lt;BR /&gt; "Montgomery": "Montgomery",&lt;BR /&gt; "Prince George\'s": "Prince George\'\'s",&lt;BR /&gt; "Queen Anne\'s": "Queen Anne\'\'s",&lt;BR /&gt; "St. Mary\'s": "St. Mary\'\'s",&lt;BR /&gt; "Somerset": "Somerset",&lt;BR /&gt; "Talbot": "Talbot",&lt;BR /&gt; "Washington": "Washington",&lt;BR /&gt; "Wicomico": "Wicomico",&lt;BR /&gt; "Worcester": "Worcester"&lt;BR /&gt; }&lt;BR /&gt;for k,v in CountyDict.items():&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if k == "Prince George's":&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qry = '"' + "COUNTY" + '"' + " IN ('{}')".format(v)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByAttribute_management(fc, 'NEW_SELECTION',qry)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 17:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-records-from-feature-class-that-have/m-p/203378#M15630</guid>
      <dc:creator>LuisResh</dc:creator>
      <dc:date>2019-07-26T17:41:06Z</dc:date>
    </item>
  </channel>
</rss>

