So I have a python program that writes prime numbers into a csv file. I now want my python file to make a copy of itself after it runs everything, as a backup for when I tweak around with the original file.
I've gotten away with not knowing this so far by making the python program make a new .py file and then writing everything inside it, but this is super inefficient. I'd like it to be cleaner and less complicated.
I've heard a little bit about using shutil.copyfile, but I'm not too sure about how to use it. Is shutil.copyfile the best way to make my python file copy itself, or is there a better way?