Python, Automation, Data Science, Artificial Intelligence, Llm.
directory = 'path/to/directory' # Search for files with a specific extension extension = '*.txt' files = glob.glob(directory + '/' + extension) # Print the matching files for file in files: print(file) This code snippet defines the directory in which to search for files and the desired file