seek()值怎么???怎么用? 012?
f?=?open('hello',?'a+') f.seek(0) a?=?f.read() print(a) f.seek(0) f.write('aaaa')
上述代碼,為什么aaaa,寫到了文件最后面
f?=?open('hello',?'a+') f.seek(0) a?=?f.read() print(a) f.seek(9) b=f.read() print(b)
seek()里面寫幾就從第幾位開始取,這個(gè)0開頭1當(dāng)前位置2結(jié)束相違背呀~
2022-08-16
當(dāng)使用了 追加模式時(shí),seek()函數(shù)沒有作用