I Need to know whats the correct way of declaring folder path , suppose I have a dummy.py file inside a main folder & also Inside main folder 2 child folders are present images & music , now if i want to declare a image22.img from images folder in dummy.py which one is correct among the below two or both ae fine
myimage = "./images.image22.img"
or
myimage = "images.image22.img" # without ./
had got this doubt as os.path.abspath(myimage)
gives the same results for both
CodePudding user response:
The use of './' is not obligatory if you're requesting files from a folder that is on the current path.
So, in this example you don't need to use './' :
images/image22.img
CodePudding user response:
If your terminal's current working directory is main
, then your path string should look like this.
myimage = './images/image22.img'
#or
myimage = 'images/image22.img'