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!"
請注意,英文文本將有助於瞭解該程序。 –