Is there any standard function or method in python that reads all files from the directory where the python source program is located? Example: Let be the follow code bellow:
import glob, os
from os.path import isfile
def namesARCHIVES():
listNames = []
os.chdir(r"C:\Users\author\archives")
for file in glob.glob("*.txt"):
listNames.append(file)
The method os.chdir(r"C:\Users\author\archives")
"reads" the directory that contains all the files I need. The python file you compile is in the same folder. Is there any method that does not need to enter the directory of the files as they are in the same folder as the source code? I don't know if it was well explained