📅  最后修改于: 2022-03-11 14:45:30.597000             🧑  作者: Mango
## Using scandir
import os
directory = r'C:\Users\admin'
for entry in os.scandir(directory):
if (entry.path.endswith(".jpg")
or entry.path.endswith(".png")) and entry.is_file():
print(entry.path)