This was tricky. The normal open() reads the file location relative to where it is called from. But in cases we need to open a file relative to the location of the module, we can use the the trick of using the location of __file__. It surely won't work from interpreters.
This was tricky. The normal
open()
reads the file location relative to where it is called from. But in cases we need to open a file relative to the location of the module, we can use the the trick of using the location of__file__
. It surely won't work from interpreters.