0
我想写一个登录模块使用Python 2-7。首先注册并创建文本文件。而当你尝试登录时,它必须是登录。但是,当我输入正确的用户名称它说错了用户名。我如何解决它?登录/ Python密码不匹配登录脚本
import time
from datetime import datetime
print "Hos Geldiniz!"
print "Giris Yapmak icin 1'i"
time.sleep(1)
print "Kayit Olmak icin 2'yi tuslayiniz"
sec1 = int(input("--> "))
if sec1 == 2:
ifsec1 = raw_input ("Kullanici Adi Giriniz= ")
dosya = open("kadi.txt","w")
dosya.write(ifsec1)
ifsec2 = raw_input ("Sifre Giriniz= ")
dosya2 = open("sifre.txt","w")
dosya2.write(ifsec2)
print "Basariyla Kayit Olundu!"
print "Giris Yapmak icin programi kapatip aciniz"
if sec1 == 1:
ok1 = open("kadi.txt","r")
ok2 = open("sifre.txt","r")
kadi = raw_input ("Kullanici Adim= ")
if (kadi == ok1):
sifre = raw_input ("Sifrem= ")
if (sifre == ok2):
print kadi + ", Olarak Giris Yapildi"
print "Hosgeldin, " + kadi
else:
print "Yanlis Sifre!"
else:
print "Yanlis Kullanici Adi!"
请注意,英文文本将有助于了解该程序。 –