溫馨提示×

python getcwd函數(shù)如何獲取當(dāng)前工作目錄

小樊
82
2024-08-26 15:35:11
欄目: 編程語言

要獲取當(dāng)前工作目錄,可以使用Python中的os模塊中的getcwd()函數(shù)。示例如下:

import os

current_dir = os.getcwd()
print("Current working directory:", current_dir)

運(yùn)行上述代碼,將輸出當(dāng)前工作目錄的路徑。

0