Answers for "python export console output to 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

Python Answers by Framework

Browse Popular Code Answers by Language