I want to know how to delete/clear all text in a file inside another python file, I looked through stack overflow and could not find a answer, all help appreciated. Thanks!
I want to know how to delete/clear all text in a file inside another python file, I looked through stack overflow and could not find a answer, all help appreciated. Thanks!
Just as you would a text file:
with open("file_to_clear.py", "w") as file:
file.write("")
I think that's what you're looking for. You were probably being misled because all the examples are on text files, but it works with Python files too!
Things to look into(google terms) to get your answer:
Once you have tried all of the following, and are still struggling with the task. Please review https://stackoverflow.com/help/how-to-ask, and feel to free to rework/edit your question.