import os
#ask user for DIR 
files_dir=input("Enter DIR path:")
for i in files_dir:
    if i == "\\":
        index_of_the_slash = files_dir.find(i)
        filePath= files_dir.replace(rename_files_dir[index_of_the_slash],"/")
#change dir
os.chdir(filePath)
#list of files in dir
filenames=os.listdir()
#Replace x with the number of letters you need
for m in filenames:
    #customise to get what you need
    os.rename(m,(m[0:x]+".pdf"))