def delete(self, key):
key = str(key)
if key not in self.data["accounts"]:
print("Account with given index does not exist")
return
return_value = self.data["accounts"].pop(key)
account_keys = [int(indices) for indices in self.data["accounts"].keys() if int(indices)>int(key)]
for indices in account_keys:
temp_value = self.data["accounts"].pop(str(indices))
self.data["accounts"][str(indices-1)] = temp_value
if self.account == indices: self.account -= 1
self.number_of_accounts -= 1
if self.account == int(key): self.account = None
keyring.delete_password(*return_value)
return key,return_value
评论列表
文章目录