-----------------------------首先将已有文件读入内存中-----------------------------------
>>> name = file("name.txt","a")   //(将name.txt文件读入到内存中,且允许对原文件追加写入  a表示允许追加写入 )
-----------------------------写入新内容到name.txt文件中--------------------------------
>>> name.write("hello 3")
-----------------------------将文件从内存中删除,并且保存到硬盘中-----------------
>>> name.close()
>>> 
//删除后将不能继续写入,除非重新读入
>>> name.write("hello 3")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: I/O operation on closed file
>>> 
--------------------------查看name.txt文件变化------------------------------------
[root@localhost ~]# cat name.txt 
hello 
hello 222
hello 3[root@localhost ~]#