relative paths connect using python

Xristos Xristoou saxri89 at gmail.com
Mon Mar 20 13:05:23 EDT 2017


i have a little confused problem. i want to store some paths from images using python 2.7 in windows 10.
i have some relative path like this var1='C:/my/store/path' and in the final folder where in my example is the name 'path' inside that folder i have some images like this :
-path
   -myimage_1010_im.png
   -myimage_1010_im1.png
   -myimage_1010_im3.png
   -myimage_1020_im.png
   -myimage_1020_im1.png
can i connect my relative path like var1 with the images using only the number of the mid name of images and finaly i take the full original path like this var1='C:/my/store/path/myimage_1010_im.png' ?
i try something but not work 
import os
cwd = os.getcwd()
path = os.path.join(cwd, "my_file")


More information about the Python-list mailing list