Python 遍历文件夹里面的内容 5*


root_path='./result'
sub_path=root_path+'./tmp'
for root, dirs, files in os.walk(sub_path):
    for file in files:
        if os.path.splitext(file)[1] == '.jpg':  
            print(file)
            #print(os.path.splitext(file))

猜你喜欢

转载自blog.csdn.net/tony2278/article/details/83447309