fo=open('renren.txt','a')
官方文档:
mode can be 'r' when the file will only be read, 'w' for only writing (an
existing file with the same name will be erased), and 'a' opens the file for
appending; any data written to the file is automatically added to the end. 'r+' opens the file for
both reading and writing. The mode argument is optional; 'r' will be assumed if it’s
omitted.
你好:
那就用追加啊?
四二个参数改为“a”;
r+是允许读写,a才是添加