Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import os
  2.  
  3. # Đường dẫn tới thư mục chứa file
  4. base_path = 'demo'
  5.  
  6. for root, dirs, files in os.walk(base_path):
  7. print(root) # Trả về đường dẫn tới các thư mục
  8. print(dirs) # Trả về tên các thư mục
  9. print(files) # Trả về tên file (Note: Không chứa thư mục)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement