售前咨询:400-100-2938
要获取当前工作目录,可以使用Python中的os模块中的getcwd()函数。示例如下:
import os current_dir = os.getcwd() print("Current working directory:", current_dir)
运行上述代码,将输出当前工作目录的路径。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:python getcwd函数的最佳实践是什么