Bonjour
Est il possible d'afficher le chemin du script excecute
exemple
si on execute python /home/test.py
on affiche /home
et meme si on on exceute a partir de /home
python test.py on affiche /home
Version imprimable
Bonjour
Est il possible d'afficher le chemin du script excecute
exemple
si on execute python /home/test.py
on affiche /home
et meme si on on exceute a partir de /home
python test.py on affiche /home
j'ai trouve
il suffit d'utiliser
Code:
1
2
3
4
5 import os.path print os.path.abspath( os.path.dirname( __file__))
alors merci de le marquer résolu
;)