Python Forum

Full Version: 'invalid syntax' error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
def accCredDatabasesMethod(method):
    if method=="open":
        accUsernameDatabase=open("accUsernameDatabase.txt","w+")
        accPasswordDatabase=open("accPasswordDatabase.txt","w+")
        if accUsernameDatabase.read() not in userList:
            userList.append(accUsernameDatabase.read())
            if '' in userList:
                userList.remove('')
        elif accPasswordDatabase.read() not in passList:
            passList.append(accPasswordDatabase.read()
            if '' in passList:
                passList.remove('')
can you help me to understand and fix why there is an 'invalid syntax' error with the ':' in the second last line? (
if '' in passList:
On the previous line, there is a missing ).
Thank you very much.
Any time you get a weird syntax error like that, the problem is usually on the previous line. We've all done it.