Python-匹配来自外部文件的数据(用户名密码)

我知道这与换行标记有关,但是为什么我的程序在我的外部文件中找不到用户名/密码匹配?

username = input("Please enter your username: ")
password = input("Please enter your password: ")
file = open("usernamesPasswords.txt","r")
for loop in file:
    line = file.readline()
    data = line.split(",")
    print(data)
    if username == data[0] and password == data[1]:
        print("That's a match")
    else:
        print("That's not a match!")
        break
file.close()
senveny1234567 回答:Python-匹配来自外部文件的数据(用户名密码)

假设import streamlit as st x = 1 if st.button("Increment x"): x=x+1 st.text(x) 看起来像这样:

UsernamesPasswords.txt

我们可以编写代码:

username_1,password_1
username_2,password_2
username_3,password_3
本文链接:https://www.f2er.com/2934109.html

大家都在问