classAddressList():def__init__(self,name,age,qq):self.name=nameself.age=ageself.qq=qqdefgetList(self):print"Thenameofyourresultis:",self.nameprint"Theageofyourresultis:",...
class AddressList():
def __init__(self,name,age,qq):
self.name=name
self.age=age
self.qq=qq
def getList(self):
print "The name of your result is :",self.name
print "The age of your result is :",self.age
print "The qq of your result is :",self.qq
return
def searchByname(name):
if list.name==name:
print list.getList()
else:
return ("The people does't exit")
def searchByage(age):
if list.age==age:
print list.getList()
else:
print ("This age of people does't exit")
def searchByqq(qq):
if list.qq==qq:
print list.getList()
else:
print ("The qq does't exit")
if __name__ =="__main__":
name=raw_input("Please input the name:")
age=raw_input("Please input the age:")
qq=raw_input("Please input the qq:")
list = AddressList(name,age,qq)
print list.getList()
method=raw_input("Which element do you want search by ? :")
print method
if (method==name):
name = raw_input("Input your search name:")
searchByname(name)
elif method==age:
name = raw_input("Input your search age:")
searchByage(name)
elif method==qq:
name = raw_input("Input your search qq:")
searchByqq(name)
为什么会多出一个None的,去掉getList函数里面最后一个return还是会出现,还有最后输入查找元素内容之后,为什么程序就断开了?,
展开