I'm trying to find out how I can have python detect what directory the python file is in, but I just can't.
My code (Not really mine but it's just for an example):
import os
dirname = "C:\\Users\Derek\Desktop\Bob"
bob = os.listdir(dirname)
print(bob)
Basically what I'm wanting is for python to find out dirname on it's own when I move the .py file to a new directory (for example, if I move the python file to "C:\\Users\Derek\Desktop\Bob\Test" then I want it to automatically detect that.)
I'm using
Miscellaneous operating system interfaces.