Whilst running a novice project in Python, I tried to find the absolute path of a file given its relative file path, but I end up with the wrong absolute file path. One of the folders is not shown in the output.
Here is the code:
import os
a = os.path.abspath("abc.txt")
print(a)
This is what I get as an output: /Users/***/abc.txt
But when I check the file directory of my abc.txt file, the actual file path is: /Users/***/Documents/abc.txt.
Hence when I use this output in another file I end up with errors that this file isn't found. Can anyone tell me the logic behind this and what I should do to display the full file path?