Given a path such as "mydir/myfile.txt", how do I find the file's absolute path relative to the current working directory in Python? E.g. on Windows, I might end up with:
"C:/example/cwd/mydir/myfile.txt".
I tried: mypath = os.path.abspath("../mydir/myfile.txt"). But I got:
>> print(mypath)
C:\example\cwd\mydir\myfile.txt
Note that when I execute mypath I have C:\\example\\cwd\\mydir\\myfile.txt.