Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os.path
- def check_folder(name):
- path = os.path.join(os.path.expanduser("~"), name)
- if os.path.exists(path):
- if os.path.isdir(path):
- if len(os.listdir(path)) == 0:
- print(f"Директория {path} была пуста и удалена")
- os.rmdir(path)
- else:
- print(f"Директория {path} не пуста")
- else:
- print(f"{path} не является директорией")
- def main():
- name = input("Введите название директории:\n")
- check_folder(name)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment