[Solved] How to save python script as txt? [closed]


Does this works out fine for you?
First read in the python file and save it in a variable and them simply write it out on another file.

def write_python_file(filename):
    with open(filename) as f:
        data = f.read()
        f.close()

    with open("Data.txt", mode="w") as f:
        f.write(data)
        f.close()

write_python_file("filename.py") # Replace with your python file.

Hope so this is useful information for you.

solved How to save python script as txt? [closed]