0
我在記事本中排有user;password;fullname
。PYTHON(PYQT) - CSV - 按行讀取
我的表單應該只接受用戶和密碼,當我把它放在線上的小部件,但每次我運行這個,我的表單退出。
def login_button_clicked(self):
import csv
with open('user.txt', newline='') as f:
reader = csv.reader(f, delimiter=';', quoting=csv.QUOTE_ALL)
for row in reader:
us, pa, fn = line.rstrip().split(';')
if self.username_line.text() == us and self.password_line.text() == pa:
QtWidgets.QMessageBox.information(self, "LOGIN", "LOGIN SUCCESSFUL!")
self.isLogged.emit()
self.close()
return
else:
QtWidgets.QMessageBox.information(self, "LOGIN FAILED", "LOGIN FAILED!")