📜  将函数的输出写入 txt 文件 - Python 代码示例

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

代码示例1
def out_fun():
  return "Hello World" 
output = out_fun() 
file = open("sample.txt","w") 
ile.write(output) file.close() 
#Copy and paste...will work.