在 Python 中,你可以使用 os 模块来获取当前工作目录(当前路径)。你可以按照以下步骤来获取当前路径:
os
导入 os 模块:
import os
使用 os.getcwd() 函数来获取当前工作目录的路径:
os.getcwd()
current_path = os.getcwd() print("当前路径是:", current_path)
以上代码将打印出当前工作目录的路径。这样你就可以在 Python 程序中获取并使用当前路径信息了。