Day3-R+/W+ seek, tell

'''
# R+ read and write
f = open("yesterday",'r+',encoding="utf-8")
print(f.readline())
print(f.tell())
f.write("---------first line-------------")
print(f.readlines())

'''
#w+ write and read
f = open("yesterday",'w+',encoding="utf-8")

print(f.tell())
f.write("---------first line-------------")
print(f.tell())
f.seek(10)
print(f.readline())
f.write("-------------------second line-------------")
f.write("-------------third line----------------")
上一篇:Python基础教程——for循环语句


下一篇:python文件的定位读写