Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- path = "D:/PythonSuli"
- folders = []
- files = []
- for i in os.listdir(r"D:\PythonSuli"):
- if os.path.isdir(os.path.join(path, i)):
- folders.append(i)
- else:
- files.append(i)
- folder_content = sorted(folders, key=lambda x:x.lower()) + sorted(files, key=lambda x:x.lower())
- print(folder_content)
Advertisement
Add Comment
Please, Sign In to add comment