Try this :
person_dict = {f'person-{n+1}' : [name, roll, email] for n, (name, roll, email) in enumerate(zip(name_list, roll_list, email_list))}
Output :
person_dict
would be :
{
'person-1': ['alex', '1', '[email protected]'],
'person-2': ['sam', '2', '[email protected]'],
'person-3': ['name-n', 'roll-n', 'email-n']
}
In this way, you won't have n
number of different variables assigned to their corresponding list, but you'll have one dictionary and you can look up keys from that dictionary with person_dict.get(key)
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…