+ 3
how to append
f=open("test111.txt","a") print(f.append("samjhe")) f.close() showing: AttributeError: '_io.TextIOWrapper' object has no attribute 'append'
4 ответов
+ 3
this is right code.
f=open(r"test111.txt","a")
f.write("samjhe")
f.close()
+ 1
f. write() will append the text by default since you are opening the file in "a" that is append mode
hence type f. write("samjhe") instead of f. append("samjhe")