3 回答
TA贡献1825条经验 获得超4个赞
取代:
input("Enter the password you want to delete: ")
跟
print("Enter the password you want to delete: ")
(你有两个s,你只需删除第一个的值)input
TA贡献1851条经验 获得超3个赞
你可以试试这个:
deletePassword = input("Enter the password you want to delete: ")
passwords = [password for password in passwords if password[0] != deletePassword]
TA贡献1877条经验 获得超6个赞
我建议您将密码存储为字典,而不是列表列表。这允许您按名称而不是数字索引(每次修改列表时都会更改)来查找/访问站点。
passwords = [["facebook", "gGjjI%%%66"], ["youtube", "coYtF###12$"]]
passwords = dict(passwords)
# passwords is now {'facebook': 'gGjjI%%%66', 'youtube': 'coYtF###12$'}
if choice == '6':
print("Enter the site name of the password you want to delete: ")
for site in passwords:
print(' ', site)
deletePassword = input('>')
if deletePassword in passwords:
passwords.pop(deletePassword)
添加回答
举报