<?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: List from CSV is empty in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/list-from-csv-is-empty/m-p/1023932#M59816</link>
    <description>&lt;P&gt;the DictReader returns a dictionary and I don't see where you are parsing the value to check against your fc name list.&amp;nbsp; Print the row from the csv cursor to see what format it is in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or just use csv.reader(csv_file) if you don't need a dictionary of values, which I don't think you need for this.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Feb 2021 16:42:59 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-02-05T16:42:59Z</dc:date>
    <item>
      <title>List from CSV is empty</title>
      <link>https://community.esri.com/t5/python-questions/list-from-csv-is-empty/m-p/1023854#M59811</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am trying to read in a list from a csv file, using that to select Features within SDE.&lt;/P&gt;&lt;P&gt;The list is empty??&lt;/P&gt;&lt;P&gt;The csv file is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;server.gis.BreedingBirdSurvey_Tbl,
server.gis.Heronries_Tbl,
server.gis.Invertebrates_Pt,
server.gis.Vertebrates_Pt,
server.gis.FreshwaterFishCounts_Pt,
server.gis.InvasiveNonNativeSpecies_Pt,
server.gis.MacroinvertebrateSurvey_Pt,
server.gis.MacrophyteSurvey_Pt,
server.gis.PriorityHabitat_Pt,
server.gis.RiverHabitatSurveys_Pt,
server.gis.NonNative_Pt,
server.gis.RareProtectedSpecies_Pt&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#### Features
fcs = arcpy.ListFeatureClasses("server.gis.*")

#### CSV file
asc_f = r"W:\My Documents\user\AS_1.csv"

print("LOOP")
with open(asc_f, mode='r') as csv_file:
    csv_reader = csv.DictReader(csv_file)
    for row in csv_reader:
        #print(row)               

        for fc in fcs:
            if fc == row:
                new_name = fc.split(".")[-1]
                #print(fc)
                print(row)
                #arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, new_name)
            else:
                print("NOT in list")

############                               
print("END")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;From 
print("LOOP")
with open(asc1_f, mode='r') as csv_file:
    csv_reader = csv.DictReader(csv_file)
    for row in csv_reader:
        print(row) 

This returns:
START
LOOP
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.Heronries_Tbl')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.Invertebrates_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.Vertebrates_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.FreshwaterFishCounts_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.invertebrateSurvey_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.MacrophyteSurvey_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;It returns:
START
LOOP
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;I expected:
'server.gis.BreedingBirdSurvey_Tbl', 
'server.gis.Heronries_Tbl'
'server.gis.Invertebrates_Pt'
'server.gis.Vertebrates_Pt'
'server.gis.MacrophyteSurvey_Pt'
'server.gis.Ancient_Woodland'
'server.gis.Sites_Special_Scientific_Interest'
'server.gis.Sites_Special_Scientific_Interest_GRP'
'server.gis.Special_Protection_Areas'


OR
"server.gis.BreedingBirdSurvey_Tbl" 
"server.gis.Heronries_Tbl"
"server.gis.Invertebrates_Pt"
"server.gis.Vertebrates_Pt"
"server.gis.MacrophyteSurvey_Pt"
"server.gis.Ancient_Woodland"
"server.gis.Sites_Special_Scientific_Interest"
"server.gis.Sites_Special_Scientific_Interest_GRP"
"server.gis.Special_Protection_Areas"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any pointers&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 13:29:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-from-csv-is-empty/m-p/1023854#M59811</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2021-02-05T13:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: List from CSV is empty</title>
      <link>https://community.esri.com/t5/python-questions/list-from-csv-is-empty/m-p/1023932#M59816</link>
      <description>&lt;P&gt;the DictReader returns a dictionary and I don't see where you are parsing the value to check against your fc name list.&amp;nbsp; Print the row from the csv cursor to see what format it is in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or just use csv.reader(csv_file) if you don't need a dictionary of values, which I don't think you need for this.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 16:42:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-from-csv-is-empty/m-p/1023932#M59816</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-05T16:42:59Z</dc:date>
    </item>
  </channel>
</rss>

