With an interface like a = copyf(dictlist, key, valuelist)
.
>>> dictlist = [{'first': 'James',
'last': 'Joule'},
{'first': 'James',
'last': 'Watt'},
{'first': 'Christian',
'last': 'Doppler'}]
>>> valuelist = ['James', 'John']
>>> x = copyf(dictlist, 'first', valuelist)
>>> print(x)
[{'first': 'James',
'last': 'Joule'},
{'first': 'James',
'last': 'Watt'}]
The dictlist
is effectively a csv.DictReader
instance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…