过滤掉指定内容开头的文件名
import os with os.scandir(r"C:\Users\macname\Desktop") as it: for entry in it: if not entry.name.startswith('Auto') and entry.is_file(): print(entry.name)
import os with os.scandir(r"C:\Users\macname\Desktop") as it: for entry in it: if not entry.name.startswith('Auto') and entry.is_file(): print(entry.name)