多行写入

1 # ------多行写入------
2 nums = ['one','two','three','four','five','six','seven']
3 t = open(r'd:\python_fileprocess\t2.txt','a')
4 for get_one in nums:
5     t.write(get_one+'\n')
6 t.close()
7 print('连续写入完成!')

 

posted @ 2020-05-22 15:32  小他_W  阅读(119)  评论(0编辑  收藏  举报