I want to find top-level folders that have only digits in names. F.e. we have such folder structure
.
├── Folder1
| ├── some.file
├── 111
| ├── some.folder
| ├── some.file
| ├── some.file
| ├── some.file-2
├── 555
| ├── some.folder
| ├── some.file
Expected results: found folders '111' and '555'
Here is my code:
import os
main_path = 'C:\\Users'
top_folders_list = next(os.walk(main_path))[1]
condition = '111'
if condition in top_folders_list:
...do_something...
Code works but (of cource) only for folder '111'. Which condition should I use for matching '111', '555' and all other top-level folders that have only digits in names?