📜  python 打印到文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:16.547000             🧑  作者: Mango

代码示例6
# Print to the text file
file = open('log.txt', 'w')
print('This is a sample print statement', file = file)
print('Hello World', file = file)

file.close()