Python print() လုပ်ဆောင်ချက်
ဥပမာ
မျက်နှာပြင်ပေါ်တွင် မက်ဆေ့ခ်ျကို ပရင့်ထုတ်ပါ-
print("Hello World")
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
လုပ်ဆောင်ချက် သည် print()
သတ်မှတ်ထားသော မက်ဆေ့ချ်ကို ဖန်သားပြင် သို့မဟုတ် အခြားစံထုတ်ပေးသည့်ကိရိယာသို့ ပရင့်ထုတ်သည်။
မက်ဆေ့ချ်သည် စာကြောင်းတစ်ကြောင်း သို့မဟုတ် အခြားအရာဝတ္ထုတစ်ခုခု ဖြစ်နိုင်သည်၊ အရာဝတ္ထုကို စခရင်သို့မရေးမီ စာကြောင်းအဖြစ်သို့ ပြောင်းလဲသွားမည်ဖြစ်သည်။
အထားအသို
print(object(s),
sep=separator, end=end, file=file, flush=flush)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
object(s) | Any object, and as many as you like. Will be converted to string before printed |
sep='separator' | Optional. Specify how to separate the objects, if there is more than one. Default is ' ' |
end='end' | Optional. Specify what to print at the end. Default is '\n' (line feed) |
file | Optional. An object with a write method. Default is sys.stdout |
flush | Optional. A Boolean, specifying if the output is flushed (True) or buffered (False). Default is False |
နောက်ထပ် ဥပမာများ
ဥပမာ
အရာဝတ္ထုတစ်ခုထက်ပို၍ ပရင့်ထုတ်ပါ-
print("Hello", "how are you?")
ဥပမာ
tuple တစ်ခုကို ပုံနှိပ်ပါ
x = ("apple", "banana", "cherry")
print(x)
ဥပမာ
စာနှစ်စောင်ကို ပရင့်ထုတ်ပြီး ခြားနားချက်ကို သတ်မှတ်ပါ-
print("Hello", "how are you?", sep="---")