samedi 28 février 2015

if in 'one file' and not in 'second file'

i've got a short question. I'm from Germany and I'm writing a library-management program. I've got a code, that asks if the entered username is in the user list and not in the list with locked persons (who haven't got the permissions to borrow books), but it doesn't works! Here's the code:



borrower=input("User ID: ")
userlist = open("userlist.txt", "r")
locked = open("locked.txt", "r")
if borrower in userlist and borrower not in locked:
#dosomething
elif borrrower in userlist and borrower in locked:
print("User",borrower,"isn't allowed to borrow books!")
else:
print("[ERROR] User",borrower,"doesn't exist!")


Please tell me what's wrong with this.


Aucun commentaire:

Enregistrer un commentaire