This commit is contained in:
marcel-dempers 2021-09-04 09:14:37 +10:00
parent 2f778931f3
commit 976e397c1f

View File

@ -19,9 +19,13 @@ def getCustomers():
else:
return {}
def updateCustomers(customer):
def getCustomer(customerID):
customer = getCustomers()
return customer[customerID]
def updateCustomers(customers):
with open('customers.json', 'w', newline='') as customerFile:
customerJSON = json.dumps(customer)
customerJSON = json.dumps(customers)
customerFile.write(customerJSON)
customers = {
@ -35,16 +39,15 @@ customers = {
"h" : Customer("h", "Marcel", "Dempers")
}
customerDict = {}
for id in customers:
customerDict[id] = customers[id].__dict__
updateCustomers(customerDict)
customers = getCustomers()
customers["i"] = Customer("i", "Bob", "Smith").__dict__
customers["i"] = Customer("i", "Marcel", "Dempers").__dict__
updateCustomers(customers)
print(customers)