path = 'd:\\test'
for x in os.listdir( 'd:\\test' ): #
# 判断某个路径是否是一个目录
if os.path.isdir( os.path.join( 'd:\\test', x ) ): # isdir 参数需要传入绝对路径
print( 'dir: ', os.path.join('d:\\test', x ) )
# 判断某个路径是否是一个文件
if os.path.isfile( path + "\\" + x ): # isfile 参数需要传入绝对路径
print( "file: " , path + "\\" + x )
#