Saving .py current code to a specific folder

Viewed 43

Is it possible to save the current code of my program to a specific folder? Telling the computer to save the .py file to a created folder in a absolute path.

1 Answers

Something like... simply making a copy of your current py file? Like this?

with open(__file__, "r") as src:
    with open("some_full_path_you_want_to_copy_this_to.py", "w") as tgt:
        tgt.write(src.read())
Related