python使用sys模塊
提問(wèn)人:楊紫紅發(fā)布時(shí)間:2020-11-18
sys模塊內(nèi)部有一個(gè)特殊的對(duì)象稱(chēng)為stdin(標(biāo)準(zhǔn)輸入),它提供了一個(gè)相當(dāng)有用的函數(shù)readline。ReadLine函數(shù)用于讀取一行文本類(lèi)型在鍵盤(pán)上,直到按回車(chē)鍵。
import sys
def ageEV():
print('How old are you?')
age = int(sys.stdin.readline())
if age <= 15:
print('you are a child!')
elif age >15 and age<40:
print('you are a young!')
else:
print('you are old!')
ageEV()
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>