I am using os
in Python to retrieve a list of files in a folder. Once I get the list, I want to clean up the names of the files and remove the ".pdf" at the end of each file name. What I'm trying, is not working.
path = "C:/....."
dirs = os.listdir(path)
dirs = pd.DataFrame(data=dirs)
dirs.replace({".pdf", None}, inplace=True)
print(dirs, sep="\n")
These are an example of the files in my folder
So basically, I only want to keep the digits of the filename.