I want to write all the Game.py console outputs to a new file every time its ran.
In my Game.py I run all the methods of my game through this
Game.py file:
class Game():
def play():
print("Some Text")
if __name__ == "__main__":
game = Game()
game.play()
Just for clarity what I want is for the printed text to be saved to a .txt file.
game1.txt would have this inside Some Text
I looked at some code before but I can't get my head around it, how would I do this with stdout?