#文件指针
#tell获取当前文件指针
fobj=open("./abcde.txt","wt")
print(fobj.tell())
fobj.write("abc")
print(fobj.tell())
fobj.close()
# rt+ wt+ at+允许移动文件指针 seek(offset,whence) offset偏移量 whence 默认0从文件开始算起 1从当前位置算起 2从文件末尾算起
def writeFile():
fobj=open("./cc.txt","wt+")
print(fobj.tell())
fobj.write("123")
print(fobj.tell())
fobj.seek(1,0)
print(fobj.tell())
fobj.write("abc")
print(fobj.tell())
fobj.close()
def readFile():
fobj=open("./cc.txt","rt+")
rows=fobj.read()
print(rows)
fobj.close()
try:
writeFile()
readFile()
except BaseException as err:
print(err)