f=open("text.txt","w")
f.write("What is this?")
在新终端中:
x=open("text.txt","w")
x.write("I am going to do the same.")
x.close()
然后我尝试读取并打印文件的内容:
x=open("text.txt","r")
print(x.read())
What is this? do the same. #this is the output. I want to understand how this happened.
饮歌长啸
相关分类