Skip to content Skip to sidebar Skip to footer

How Do I Check If The Account Is Saved?

I am trying to get the program to search if the user has created an account or not. print'\n' search = raw_input('For which account are you searching: ') f = shelve.open('password

Solution 1:

You posted different code from what the error is reporting. I'm going to assume you just changed for line in f[search]: to for line in passwrd:. In that case you need to first check if you even have search available in your file. You can either put it first:

if searchin f:
    for line in f[search]:
        ...

or give it an empty default:

for line in f.get(search, []):
    ...

Post a Comment for "How Do I Check If The Account Is Saved?"