'invalid syntax' error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: 'invalid syntax' error (/thread-23143.html) |
'invalid syntax' error - rix - Dec-12-2019 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: RE: 'invalid syntax' error - stullis - Dec-12-2019 On the previous line, there is a missing ). RE: 'invalid syntax' error - rix - Dec-12-2019 Thank you very much. RE: 'invalid syntax' error - stullis - Dec-12-2019 Any time you get a weird syntax error like that, the problem is usually on the previous line. We've all done it. |