Hello friends I am trying to be able to modify the content of a specific variable, which is inside an object in a list, by means of the index I can obtain the position of the object in the list, but how can I do it to specifically modify the content of one of the variables of such an object, for example: I have the class:
class Paciente:
def __init__(self, cod, name, lastname, dni, bornDate):
self.codigo = cod
self.nombre = name
self.apellido = lastname
self.cedula = dni
self.FechaNacimiento = bornDate
Then something of what I am trying to do is the part of the code that I try to solve where I ask the user to enter a field of the object that he wants to modify, once he finds the object in the list, I want to modify the variable "Name" of that object that is in position n
if(menu == 3):
encontrado = False
ced = input("Ingrese Cedula a Consultar del paciente: ")
for e in lst:
if(ced == e.cedula):
encontrado = True
ind = lst.index(e)
break
if (encontrado):
mod = int(input("Escriba 1 si desea modificar este elemento: "))
if (mod == 1):
objPaciente = Paciente(0,"","","","",)
objPaciente.nombre = input("ingrese Nuevo Nombre: ")
lst.insert(e, aquí no sé que hacer?????)
I would appreciate a lot of your help Thanks!