Understanding Python dict Statement:
I am new to Python, so forgive me if I’m asking questions about what should be obvious. If this is posted in the wrong place, my apologies: please let me know where I should be posting this.
Using Python 2.7.
I am re-using and modifying 2014 code that was written by Martjin Pieters and posted to StackOverflow [message 5268929]. It allows for the comparison of two CSV files, reporting on the differences between the master and host files. I thank him for this head start. I am comparing a file exported from ArcGIS using ArcPy. Here it is:
1 #2/3/2021
2 #Source: Stack Overflow "Compare two CSV files and search for similar items”
3
4 import csv
5
6 with open('masterlist.csv', 'rb') as master:
7 master_indicies = dics ((r[1], i) for i, r in enumerate(csv.reader(master)))
8
9 with open('hosts.csv', 'rb') as hosts:
10 with open('results.csv', 'wb') as results:
11 reader = csv.reader(hosts)
12 writer = csv.writer(results)
13
14 for row in reader:
15 index = master_indices.get(row[3])
16 if index is not None:
17 message = 'FOUND in master list (row {})' .format(index)
18 else:
19 message = 'NOT FOUND in master list'
20 writer.writerrow(row + [message])
I sort of understand most of it save one section of line 7 shown in the figure below (though not sure I’ve parsed [the colors] the components correctly):

The part highlighted in green is the one element of the dict entry I simply do not know how to read/interpret [what is ‘r’?; what is ‘i’ and what does ‘i) for i’ do; etc.]. If someone could point me to a place that I could learn about dict at an introductory level, hopefully with enough specificity that would help me to sort this out; that would be great. Just trying to get my head around this.
Thank you very much.