Python csv在找到结果后的下一个单元格

2024-09-29 23:23:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我有密码:

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的第一列以查看用户名是否存在。它起作用了。你知道吗

接下来我需要它做的是移动到该行的下一列,如果它与值匹配


Tags: csvthein密码dataifdefwith

热门问题