I make dictionary in python and append it into a list,after that I updated my keys value and then append it into my list but it remove my previous record and overwrite with the new record. How can I get out of it please guide me.
dic={
"name":"karan",
"password":"karan123"
}
List1=[]
List1.append(dic)
dic.update({"name":"Zakir","password"="Zakir123"
List1.append(dic)
Result:
[{"name":"zakir","password":"zakir123"},{"name":"zakir","password":"zakir123"},]
But I want it like this:
[{"name":"karan","password":"laran123"},{"name":"zakir","password":"zakir123"},]