Here is the general flow of my code:
Hardest part of the assignment for me:
I
had the most difficulty with step 7 (creating a for loop to populate the dictionary). I was under the impression that a separate
for loop had to be made in order to populate the dictionary. I was able to
print out the cities with the population underneath them alright, but my list would not
appear at the end of the results when I tried adding another for loop underneath (completely separate from) my
search cursor code.
The
solution was to simply add the dict.update function in the for loop of the previous code
where I conducted a search for the fields I was trying to isolate. The
rows (AKA fields), not the field names, are integral in performing the update to the dictionary, I found out.
Here is the results of my script:
In this lab, we had to create a code that would make a new geodatabase in our results folder, search for certain fields in one shapefile's attribute table, and display those fields by populating an empty dictionary with the results.
The screenshot shows the shapefiles that were copied into the geodatabase and print messages stating when a certain part of the process was completed. It prints that the search for the certain attribute table fields is underway and also that it completed. Finally, it prints a message that the dictionary is being updated and completed, with results of the dictionary underneath.
No comments:
Post a Comment