Python open() လုပ်ဆောင်ချက်
ဥပမာ
ဖိုင်တစ်ခုကိုဖွင့်ပြီး အကြောင်းအရာကို ပရင့်ထုတ်ပါ-
f = open("demofile.txt", "r")
print(f.read())
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
လုပ်ဆောင်ချက်သည် ဖိုင်တစ်ခုကိုဖွင့်ပြီး ၎င်းကို open()
ဖိုင်အရာဝတ္ထုအဖြစ် ပြန်ပေးသည်။
ဖိုင်ကိုင်တွယ်ခြင်းဆိုင်ရာ ကျွန်ုပ်တို့၏ အခန်းများတွင် ဖိုင်ကိုင်တွယ်ခြင်းအကြောင်း ပိုမိုဖတ်ရှုပါ ။
အထားအသို
open(file,
mode)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
file | The path and name of the file |
mode | A string, define which mode you want to open the file in:
In addition you can specify if the file should be handled as binary or text mode
|
ဆက်စပ်စာမျက်နှာများ
ကျွန်ုပ်တို့၏ Read Files Tutorial တွင် ဖိုင်များဖွင့်နည်းကို လေ့လာပါ။
ကျွန်ုပ်တို့၏ Write/Create Files Tutorial တွင် ဖိုင်များရေးရန်/ဖန်တီးနည်းကို လေ့လာပါ။
ကျွန်ုပ်တို့၏ Delete Files Tutorial တွင် ဖိုင်များကို ဖျက်နည်းကို လေ့လာပါ။