I have the following code and I am trying to iterate across values during a search and then append to the values.
for delvt, pin in zip(temp_delvt_list, temp_pin_list):
temp[delvt].append(pin)
print temp
SPFFile = open(pathSPFfiles + temp_cell + ".spf", "r")
for line in SPFFile:
for pin in temp[delvt]:
print pin
Output of temp is:
defaultdict(<type 'list'>, {'0.1995': ['in1', 'in2'], '0.399': ['in0', 'y']})
Output of pin is only:
in0
iny
Why is pin not outputting in1 and in2 also?
Because you’re outside of the loop that changes
delvt, hence you only use the last assigned value.