Subdirectories and files in the directory traversal Python

import os

A: subdirectories and files in the directory traversal

for root,dirs ,files in os.walk(path)

root: the path name you want to access

dirs: subdirectory under the directory traversal

files: files in the directory traversal

B: directory traversal of all files

os.listdir(path)

 

Guess you like

Origin www.cnblogs.com/shuangcao/p/11315955.html
Recommended