在与Python中的用户输入匹配的列表列表中操作列表?

在与Python中的用户输入匹配的列表列表中操作列表?,python,list,Python,List,我正在创建一个虚构的失踪人员数据库。数据库是一个包含“标题”的列表:姓氏、名字、出生日期、电话号码、状态、缺少自和在上找到 除了添加新条目外,我希望用户能够通过提供他们希望更新的条目的姓氏和DoB来更新现有条目。我现在制定如下,但我有困难使这项工作 例如 用户输入:'Pelgrim',01/01/1900' 所需输出:['Pelgrim','Richard','01/01/1900','12345643',…] correct_entry = False while correct_entry

我正在创建一个虚构的失踪人员数据库。数据库是一个包含“标题”的列表:姓氏、名字、出生日期、电话号码、状态、缺少自和在上找到

除了添加新条目外,我希望用户能够通过提供他们希望更新的条目的姓氏和DoB来更新现有条目。我现在制定如下,但我有困难使这项工作

例如

用户输入:
'Pelgrim',01/01/1900'

所需输出:
['Pelgrim','Richard','01/01/1900','12345643',…]

correct_entry = False
while correct_entry == False:
    user_query = input(
        "Please provide the last name and DoB (DD/MM/YYYY) of the entry you want to update, separated by a comma: "
    )
    user_query_list = [x.strip() for x in user_query.split(",")]
    user_query_list[0] = str(user_query_list[0]).capitalize()

    for sublist in missing_persons:
        if user_query_list[0] == sublist[0] and user_query_list[1] == sublist[2]:
            print(
                "We have found the following entry to match the last name and DoB you provided: \n"
            )
            print(sublist)
        else:
            print(
                "We could not find an entry to match the information you provided. Please try again."
            )
            

欢迎对您的代码应用一些格式,并向我们提供输入数据和所需输出。请尝试提供?欢迎。对您的代码应用一些格式,并向我们提供输入数据和所需的输出。请尝试提供一个?