#创建文件,打开文件 w:创建文件
# fp = open("hello.txt","w")
# fp.write("hello world")

#读取文件 r:读取文件
fp =open("hello.txt","r")
# fp.closed
#新写入类容,步骤不能更改
fp=open("hello.txt","r+")
#读写
fp.read()
fp.write("dddddddddddd")
#同步到磁盘,刷新
fp.flush()
#读写指针移动位置
fp.seek(0)
print(fp.read())
网友评论