#
import os lst=os.scandir() for file in lst: print(file,type(file),file.name,file.path,file.is_dir())
#运行输出 <DirEntry 'demo1.py'> <class 'nt.DirEntry'> demo1.py .\demo1.py False <DirEntry 'demo2.py'> <class 'nt.DirEntry'> demo2.py .\demo2.py False <DirEntry 'demo3.py'> <class 'nt.DirEntry'> demo3.py .\demo3.py False <DirEntry 'demo4.py'> <class 'nt.DirEntry'> demo4.py .\demo4.py False
标签:文件,False,py,及子,lst,file,2.3 From: https://www.cnblogs.com/988MQ/p/16758680.html