Python File seek() နည်းလမ်း
ဥပမာ
လက်ရှိဖိုင်အနေအထားကို 4 သို့ပြောင်းပြီး ကျန်စာကြောင်းကို ပြန်ပေးပါ။
f = open("demofile.txt", "r")
f.seek(4)
print(f.readline())
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
seek()
နည်းလမ်းသည် ဖိုင်စီးကြောင်းတွင် လက်ရှိဖိုင်အနေအထားကို သတ်မှတ်ပေးသည် ။
နည်းလမ်း သည် seek()
ရာထူးအသစ်ကိုလည်း ပြန်ပေးသည်။
အထားအသို
file.seek(offset)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
offset | Required. A number representing the position to set the current file stream position. |
နောက်ထပ် ဥပမာများ
ဥပမာ
ရာထူးအသစ်ကို ပြန်ပေးပါ။
f = open("demofile.txt", "r")
print(f.seek(4))