Answers for "python write output to console and file"

1

python export console output to file

sys.stdout = open("test.txt", "w")

print("Hello World")

sys.stdout.close()
# TEST.TXT:
# Hello World
Posted by: Guest on March-03-2021

Code answers related to "python write output to console and file"

Python Answers by Framework

Browse Popular Code Answers by Language