i have followed Python get file name and change & save it in variable. which work fine and change the file name as required.
but now i am facing problem with path w
Extract the directory from the full file path, and later add it back.
path, filename = os.path.split(docfile) filename = os.path.splitext(filename)[0] newfilename = 'ok_%s.txt' % filename newpath = os.path.join(path, newfilename)