我有代码:
def checkdetails(username, password):
with open('Data.csv', 'rt') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
print(row)
if username == row[0]:
#This is where i will need to check if the password in the next column matches
这将搜索csv的第一列,以查看用户名是否存在。它有效。
接下来我需要做的是移动到该行的下一列,如果它与值匹配
答案 0 :(得分:1)
只是做:
if row[0] == username and row[1] == password: