I have two lists:
pin_list = ['in0', 'in1', 'in2', 'y']
delvt_list = ['0.399', '0.1995', '0.1995', '0.399']
I use the code:
temp = dict(zip(delvt_list,pin_list))
but I get the following:
temp = {'0.1995': 'in2', '0.399': 'y'}
What Python code do I need to write to get:
temp = {'0.1995': {'in2', 'in1'}, '0.399': {'y', 'in0'}}
or
temp = {'0.1995': ['in2', 'in1'], '0.399': ['y', 'in0']}
As an additional question, if I want to use the values in temp
to search a line that I am reading in would it be easier with sets or lists?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…