Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在python中的目录之间查找匹配文件名的最佳方法是什么?
import os folder1={x for x in os.listdir('some_directory') if os.path.isfile(x)} folder2={x for x in os.listdir('some_other_directory') if os.path.isfile(x)} common_files=folder1.intersection(folder2)