def registration():
Full_name=input("Name:")
Phone_num=input("Phone number:")
Email=input("Email:")
Address=input("Address:")
Password=input("Password:")
with open('Customer.json','w') as f:
cust[Email]={"Name":Full_name,"Contact_Number":Phone_num,"Email":Email,"Address":Address,"Password":Password,"Order history":None}
json.dump(cust,f)
if __name__=="__main__":
print('_'*30,'Welcome','_'*30)
cust={}
registration()
The json file is getting over written whenever I call the function.
I want my json file in {1:{β¦},2:{β¦}} this format.
Please rectify the mistake and help me correcting this code.
cust[Email]={"Name":Full_name,"Contact_Number":Phone_num,"Email":Email,"Address":Address,"Password":Password,"Order history":None}
with open('Customer.json','w') as f:
json.dump(cust,f)
Sir I tried this also but still the json file is getting overwritten.
please help me.