Comment définir le répertoire de travail actuel ?

Comment définir le répertoire de travail actuel en Python ?

Solution

Essayez [os.chdir][1]

os.chdir(path)          Change le répertoire de travail actuel en chemin. Disponibilité : Unix, Windows.

[1] : http://docs.python.org/library/os.html#os.chdir

Commentaires (3)

C'est peut-être ce que vous recherchez :

import os
os.chdir(default_path)
Commentaires (0)
import os
print os.getcwd()  # Prints the current working directory

Pour définir le répertoire de travail :

os.chdir('c:\\Users\\uname\\desktop\\python')  # Provide the new path here
Commentaires (7)