python export console output to file code example
Example: python export console output to file
sys.stdout = open("test.txt", "w")
print("Hello World")
sys.stdout.close()
# TEST.TXT:
# Hello World
sys.stdout = open("test.txt", "w")
print("Hello World")
sys.stdout.close()
# TEST.TXT:
# Hello World