“OS erhalten Sie aktuelles Verzeichnis” Code-Antworten

Python bekommt aktuelles Verzeichnis

import os

print(os.getcwd())
Busy Bat

Holen Sie sich eine Datei -Python -Verzeichnis

import os 
dir_path = os.path.dirname(os.path.realpath(__file__))
Agreeable Ape

OS erhalten Sie aktuelles Verzeichnis

import os

#Get Current working Directory
currentDirectory = os.getcwd()

#Change the Current working Directory
os.chdir('/home/varun')
Agreeable Alpaca

Holen Sie sich das Arbeitsverzeichnis Python

import os
os.getcwd()
Outrageous Opossum

Holen Sie sich das aktuelle Verzeichnis Python

import os
current_working_directory = os.getcwd()
print(current_working_directory) # should print the cwd

""" Bonus: If you want to change cwd, without moving file,
use the following method"""
os.chdir("path/to/directory")
Psych4_3.8.3

Python bekommt aktuelles Verzeichnis

>>> import os

>>> os.getcwd()
'C:\\Program Files\\PyScripter'

>>> os.getcwdb()
b'C:\\Program Files\\PyScripter'
SAMER SAEID

Ähnliche Antworten wie “OS erhalten Sie aktuelles Verzeichnis”

Fragen ähnlich wie “OS erhalten Sie aktuelles Verzeichnis”

Weitere verwandte Antworten zu “OS erhalten Sie aktuelles Verzeichnis” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen