Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- customer1,1
- customer2,2
- customer3,3
- customer4,4
- customer5,5
- def strip_split_read_from_file():
- bankdetails=[]
- with open("bankdetails.txt","r") as f:
- for line in f:
- line=line.rstrip() #r strip removes the new line character from the right side of the string
- split_line=line.split(",")
- for field in split_line:
- bankdetails.append(field)
- accessgranted=False
- while accessgranted==False:
- username=input("username:")
- password=input("account no:")
- for i in bankdetails:
- if username==bankdetails[i] and password==bankdetails[i+1]:
- accessgranted=True
- break
- else:
- accessgranted=False
- if accessgranted==True:
- print("Access Granted")
- else:
- print("Sorry, wrong credentials")
- if username==bankdetails[i] and password==bankdetails[i+1]:
- TypeError: list indices must be integers, not str
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement