a guest Aug 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # Check if a Directory is empty and also check exceptional situations.
- import os
- path = "C:\\Users\\Hamed\\Desktop"
- if os.path.exists(path) and os.path.isdir(path):
- if not os.listdir(path):
- print("Directory is empty")
- print("Directory is not empty")
- print("Given Directory don't exists")
RAW Paste Data