I have nested DictReader iterators, but I noticed that for build in building does not reset after each iteration in for row in location causing it to only compare the it to the last object in building after the first iteration. Why is it not resetting?
import csv
building = csv.DictReader(open('tblBuilding.csv', newline=''), delimiter=',', quotechar='"')
purpose = csv.DictReader(open('tblPurpose.csv', newline=''), delimiter=',', quotechar='"')
room = csv.DictReader(open('tblRoom.csv', newline=''), delimiter=',', quotechar='"')
location = csv.DictReader(open('Locations.csv', newline=''), delimiter=',', quotechar='"')
data, i = {}, 0
for row in location:
result = {}
for build in building:
if row['Build'] == build['BuildingName']:
result['BuildingID'] = build['BuildingID']