A fairly simple question, but for the life of me I can't figure it out...
I have the following piece of code:
os.rename(FileName, FileName.replace(".png","")+"_"+time_stamp.replace(":","-").replace(" ","_")+"_"+name_string+".png")
Basically renaming an image file.
I want to use the .format() structure, but I can't figure out how to get the .replace() function to work with this.
At the moment my converted code looks like this:
os.rename(FileName, "{}.replace(".png","")_{}.replace(":","-").replace(" ","_")_{}.png".format(FileName,time_stamp,name_string))
At the moment the error being given is "invalid syntax" at the first replace ( a caret at the "" in (".png","")).
Could someone kindly point me in the right direction for resources to help with this?
Is there a better way of doing what I'm trying to?
Thanks