Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- # Đường dẫn tới thư mục chứa file
- base_path = 'demo'
- for root, dirs, files in os.walk(base_path):
- print(root) # Trả về đường dẫn tới các thư mục
- print(dirs) # Trả về tên các thư mục
- 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