我正在寻找一种有效的方法来匹配两个列表中的哈希值,并打印出匹配的内容,以及与数据库对应的文件是什么?我完全没有主意了,有人能推荐一种方法来验证这些数据库吗?你知道吗
data_base=['9d377b10ce778c4938b3c7e2c63a229a : contraband_file1.jpg', '6bbaa34b19edd6c6fa06cccf29b33125 : contraband_file2.jpg', 'e4e7c3451a35944ca8697f9f2ac037f1 : contraband_file3.jpg', '1d6d9c72e3476d336e657b50a77aee05 : contraband_file4.gif']
hashed_files= ['6e3b028cc1972f6ad534b9fc1428eef6 : big.jpg', 'c9505a624181faa4be86cfe2af4b71eb : msc_asdf_logo.jpg', '6bbaa34b19edd6c6fa06cccf29b33125 : nothingtoseehere.docx', 'e4e7c3451a35944ca8697f9f2ac037f1 : StarWarsReview.docx', '0e89978428a4fe88fab1be364d998b57 : wargames.jpg']
我将使用python列表和字典理解:
这将导致:
使用字典和列表迭代搜索:
结果与
相关问题 更多 >
编程相关推荐