0
クラスオブジェクトでいっぱいのリストを作成しました。各オブジェクトには5つの属性があります。リスト内のオブジェクト属性からオブジェクトを検索
def searchword(list):
name = str(input("Who are you searching for? Please enter name"))
for i in list:
if list[i].name == name:
print("We found him/her. Here is all information we have on him" + str(list[i]))
else:
print("Could not be found. Check spelling!")
しかし、私はあなたが使用している場合
if list[i].name == name:
TypeError: list indices must be integers, not Person"
人は、まあ、クラスオブジェクト