samedi 31 octobre 2020

no response to if statement

Im trying to check if a username is in a csv file, the "if string in line:" works as intended, but "if string not in line:" Dosent do anything when it should. Could anyone help me? Here is the code:

''' while True: import csv with open("IDs.csv") as file: reader = csv.reader(file) q = int(input("1) Create a new User ID \n2) Change a password \n3) Display all current User IDs \n4) Quit \n\nEnter Selection:")) if q == 1: while True: newID = input("Enter a new User ID:") for line in file: if newID in line: print ("That userID is already in use, please select another one") print (newID) for line in file: if newID not in line: userpass = input("Enter a password") '''

Aucun commentaire:

Enregistrer un commentaire