#!/bin/pyton #coding=gb18030 """ 写文件 """ fn='c.txt' fp=open(fn,'w+') fp.write('i am William\n','a') fp.close() fa=open('a.txt','a') fa.write('i love wangxinxin','a')
报错:
Traceback (most recent call last):
File "D:\workspace\hellobao\src\bao\__init___06_file_1.py", line 9, in <module>
fp.write('i am William\n','a')
TypeError: function takes exactly 1 argument (2 given)
把第一个追加fp.write('i am William\n','a')改为fp.write('i am William\n')就不报错