Py学习  »  Python

python中声明文件夹路径的正确方法是什么?

agent_T • 1 年前 • 358 次点击  

我需要知道声明文件夹路径的正确方法,假设我有 笨蛋py 主文件夹中的文件(&M);在主文件夹2个子文件夹中还有“present images”和“amp;音乐,现在如果我想声明一个图像22。img from images folder in 笨蛋py 以下两种ae中哪一种是正确的或两者都是正确的

myimage = "./images.image22.img"

or

myimage = "images.image22.img"  # without ./

有这个疑问 os.path.abspath(myimage) 两种方法的结果相同

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/134466
 
358 次点击  
文章 [ 2 ]  |  最新文章 1 年前