在Python中,可以使用 os.getcwd()
函数来获取当前工作目录。示例如下:
import os
current_directory = os.getcwd()
print("Current working directory:", current_directory)
运行上面的代码将打印出当前工作目录的路径。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:python getcwd函数如何获取当前工作目录