标签:color alt -- os.path info python .com ima imp
os.path.isdir( ) 函数:判断某一路径是否为目录
os.path.isdir(path)
os.path.isfile( ) 函数:判断某一路径是否为文件
os.path.isfile(path)
path:要进行判断的路径
实例:判断E:\照片 这个路径是否为目录或文件
1 import os 2 print(‘判断该路径是否为目录:‘,os.path.isdir(‘E:\照片‘)) 3 print(‘判断该路径是否为文件:‘,os.path.isfile(‘E:\照片‘))
标签:color alt -- os.path info python .com ima imp
原文地址:https://www.cnblogs.com/bravesunforever/p/10506018.html