我希望能够在Python中搜索.csv文件中的用户ID,然后验证密码是否与用户ID匹配。任何我出错的建议都将不胜感激
到目前为止代码!
答案 0 :(得分:0)
如果ID在标题ID下
passwd = input("please enter you id ")
with open("data.csv", 'r') as f:
r = csv.DictReader(f, delimiter=',')
for row in r:
# skips the headers without next
if row['id'] == passwd:
print("the Id is valid")