python

Python os函数中如何获取当前工作目录

小樊
92
2024-08-26 10:16:26
栏目: 编程语言
Python开发者服务器,限时0元免费领! 查看>>

在Python中,可以使用 os.getcwd() 函数来获取当前工作目录。示例如下:

import os

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

运行上面的代码将打印出当前工作目录的路径。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

相关推荐:python getcwd函数如何获取当前工作目录

0
看了该问题的人还看了