用python输入名字,在列表中查找

2025-06-29 05:23:49
推荐回答(1个)
回答1:

#/usr/bin/python
name=raw_input('please input your name:').strip()
name_list=['Alex','Lucy','Lili']
if (name in name_list):
print 'your input is in the list!'
else:
print 'Sorry,not in the list!'