I am trying to write code in python to rename a file by using NAME_COMPUTERNAME_ and then the current date.
I have the following code:
PCname=socket.gethostname()
date_now = datetime.now().strftime'%d%m%Y')
file_one = "C:\\Reports\\Report.pdf"
file_two = 'C:\\Reports\\VSR_(PCname)_{}.pdf'.format(date_now)
os.rename(file_one, file_two)
I can rename the file with just VSR_14092018.pdf
but I would like to include the computername also after VSR in the file's name.
Thanks