I want to get the list of files at the location where my script is.
So let's say I have a directory - foo/bar
My script is at foo/bar/script.py
I run the script from foo
My script is this:
import os
print(os.listdir())
But when I run it from foo
, I get the contents of foo
and not foo/bar
. I want to get the contents of the script's directory, not the current working directory.
So how do I do this?