python使用os.getcwd()获取当前路径不正确
# coding=gbk
import ostry:current_dir = os.getcwd()#print(os.path.dirname(os.path.realpath(__file__)))#获取错误print("当前工作目录[不想要]:",current_dir)#获取真实文件夹路径print("当前工作目录[想要]:",os.path.dirname(os.path.realpath(__file__)))
except OSError as e:print("OSError错误:",e)
运行结果: