The following code will help you if you want to list all the file or folder names available in a directory.
For example you have the following list of files or folders in directory "C:\codes" and you want to print all the files available in this folder
Find the code below:
directory = "C:\codes" # Directory path
list_of_files = os.listdir(directory)
# list_of_files is a list which contain all the file and folder names
for file in list_of_files: