Avec python on peut facilement obtenir le chemin du répertoire courant en utilisant la fonction getcwd() du module os, exemple:
>>> import os>>> os.getcwd()'/Users/toto/Desktop'
Pour obtenir le chemin du répertoire courant dans un script python:
from os import path as os_pathPATH = os_path.abspath(os_path.split(__file__)[0])
Path donne ici le chemin complet d'où est lancé le script.
Recherches associées
| Liens | Site |
|---|---|
| os module | python doc |
| How to get full path of current file's directory in Python? | stack overflow |
| os.getcwd() | tutorialspoint |
