How can I find full path for a file?
Let's say I have this path
So, I know that
\from_here_I_now\stuff\stuff2 is a permanent path, but the beginning is different, like I know that
D:\something\something1\ may be different for someone else. How can I find the
D:\something\something1\ knowing only
Try something like this:
import os filestr = '\from_here_I_now\stuff\stuff2' fullstr = os.path.abspath(filestr) print(fullstr) >>> 'D:\something\something1\from_here_I_now\stuff\stuff2' print(fullstr[:len(filestr)]) >>> 'D:\something\something1'