I tried to name the file or rename a file in python, but it is showing a invalid syntax at the end of the path, before ',r'
os.rename(r 'D:\\Stackoverflow\\SC.png' ,r 'D:\\Stackoverflow\\Screen'+str(localtime)+'.png')
I tried to name the file or rename a file in python, but it is showing a invalid syntax at the end of the path, before ',r'
os.rename(r 'D:\\Stackoverflow\\SC.png' ,r 'D:\\Stackoverflow\\Screen'+str(localtime)+'.png')
Try this:
from datetime import datetime
import os
src = "/tmp/test.txt"
dst = "/tmp/python_" + str(datetime.now().strftime('%Y-%m-%d-%H_%M_%S')) +".inf"
os.rename(src, dst)