Python အသုံးပြုသူ ထည့်သွင်းမှု
အသုံးပြုသူ ထည့်သွင်းမှု
Python သည် အသုံးပြုသူထည့်သွင်းမှုကို ခွင့်ပြုသည်။
ဆိုလိုသည်မှာ ကျွန်ုပ်တို့သည် ထည့်သွင်းမှုအတွက် အသုံးပြုသူကို တောင်းဆိုနိုင်သည်။
နည်းလမ်းသည် Python 3.6 တွင် Python 2.7 ထက် အနည်းငယ်ကွဲပြားသည်။
Python 3.6 သည် input()
နည်းလမ်းကို အသုံးပြုသည်။
Python 2.7 သည် raw_input()
နည်းလမ်းကို အသုံးပြုသည်။
အောက်ဖော်ပြပါ ဥပမာသည် အသုံးပြုသူအမည်ကို တောင်းဆိုပြီး သင်အသုံးပြုသူအမည်ကို ထည့်သွင်းသောအခါတွင် ၎င်းကို မျက်နှာပြင်ပေါ်တွင် ရိုက်နှိပ်သွားသည်-
Python 3.6
username = input("Enter username:")
print("Username is: " + username)
Python 2.7
username = raw_input("Enter username:")
print("Username
is: " + username)
လုပ်ဆောင်ချက်နှင့် ပတ်သက်လာသောအခါ Python သည် လည်ပတ်မှုရပ်တန့် input()
သွားပြီး သုံးစွဲသူက ထည့်သွင်းမှုအချို့ကို ပေးသောအခါ ဆက်လက်လုပ်ဆောင်သည်။