====== Pfade ====== Voraussetzung: [[strings|Strings]] Einfache String Verarbeitung. Bedenke Unterschiede zwischen POSSIX (Linux) und Windows (ggf. Apple). ===== Modul os.path ===== > vor Python 1.3 String basierter Ansatz **Beispiel** from os import path home_directory_of_file = path.dirname(__file__) parallel_directory_of_file = path.abspath(path.join(MAIN_DIR, "..", "paralleldir")) **Library :** [[https://docs.python.org/3/library/os.path.html#module-os.path|os.path — Common pathname manipulations]] ===== Modul pathlib ===== > ab Python 3.4 Objektorientierter Ansatz [[https://peps.python.org/pep-0428/|PEP 428]] – The pathlib module – object-oriented filesystem paths **Beispiel** from pathlib import Path home_directory_of_file = Path(__file__).resolve().parent **Library :** [[https://docs.python.org/3/library/pathlib.html|pathlib - Object-oriented filesystem paths]]