In this post, the top answer explains how to (1) obtain the directory of the script being run, and (2) obtain the path of the working directory. However, I'm confused on the usage of __file__
. BryanOakley even states to notice the double underscore of __file__
, but I do not understand why. Essentially, what I am asking is if I wanted to use his snippet of code, how would I implement it?
I tried entering gibberish, such as 'lkajfoiwhjnafd;klj.txt'
in leiu of __file__
, and it still returned a path, even though I am certain no such file exists.