python 文件操作(open函数)

1 file_handle = open('name.txt',mode='w')
2 
3 file_handle.write("liusitonghasyasa")

这样将"liusitonghasyasa"写入name.txt是写不进去的,原因是程序结束时没有file_handle.close()语句。

原文地址:https://www.cnblogs.com/ACPIE-liusiqi/p/10517617.html