Python saves the output of print to a txt file

To save the content of the print output to a txt file, you need to use Python's open() and write() functions: f = open("filename.txt", "w") f.write("content to be written" ) f. close()

Guess you like

Origin blog.csdn.net/weixin_42588555/article/details/129576952