Python, Python Programming, Web Development, Software Development, Programming.
The directory is not empty: 'python-dev'\ It works fine, If there are no files or subdirectories in the directory to be removed. import os os.rmdir("python-codes") current_dir = os.getcwd() directories = os.listdir(current_dir) print(f'Found {len(directories)} directories in {current_dir}')