移动文件指针来操作文件
with open('file2.conf','r+') as f:
try:
#f.seek(210)
#conts=f.read(80)
f.seek(292)
#print(f.tell())
f.write('YYYYYYYYYYYYYYYYYYYY\n')
conts=f.read(80)
print(conts)
except RuntimeError as e:
print(e)
假设是一种超能力
with open('file2.conf','r+') as f:
try:
#f.seek(210)
#conts=f.read(80)
f.seek(292)
#print(f.tell())
f.write('YYYYYYYYYYYYYYYYYYYY\n')
conts=f.read(80)
print(conts)
except RuntimeError as e:
print(e)