我想比较 2 个列表中的条目:
例如:
for key in keys:
for elem in elements:
#Find a key in common with 2 lists and write the corresponding value
if key == elem:
do something
#Iterate through elements unit the current "key" value is found.
else:
pass
这种方法的问题是它非常慢,有没有更快的方法来做到这一点?
*假设len(keys) > len(elements)