How to find out if there is a subfolder in a folder, and how to write the absolute path of a subfolder to a file?

    1 answer 1

    Conveniently pathlib module for this task in Python 3:

     #!/usr/bin/env python3 from pathlib import Path path = Path('A') / 'B' if path.is_dir(): Path('путь подпапки.txt').write_text(str(path.absolute()))