Select = int(input(": ")) bir tülü terminalde çıkmıyor nasıl düzeltebilirim

from time import sleep as bekle
import sqlite3
import random
import colorama
from colorama import Fore, Back, Style
import os
from smtplib import SMTP



class Login:
    def __init__(self,name):
        colorama.init()
        self.status = True
        self.connectDB()
        self.cls_()

    def run(self):
        self.status = False
        self.mainmenu()
        choice = self.choice()

        if choice == 1:
            self.login()

        if choice == 2:
            self.signin()

        if choice == 3:
            self.forget()

        if choice == 4:
            self.status = False

    def admin(self):
        self.status = False
        self.adminmenu()
        choice2 = self.choice_2()

        if choice2 == 1:
            self.showallusers()

        if choice2 == 2:
            self.deleteusers()

        if choice2 == 3:
            self.updateusers()

        if choice2 == 4:
            self.activate()

    def adminmenu(self):
        print(Fore.GREEN)
        print("          *************\n          * A D M İ N *\n          *************")
        print(Style.RESET_ALL)

    def choice_2(self):
        while True:
            try:
                choice2 = int(input("1-Show all users\n2-Delete Users\n3-Update Users\n4-Activate\nChoice: "))
                if choice2 < 1 or choice2 > 4:
                    print("İnvalud Value.Try Again")
                else:
                    break
            except ValueError:
                print("You can't write letters.")
        return choice2

    def showallusers(self):
        self.cursor.execute("SELECT * FROM deger")

        allusers = self.cursor.fetchall()

        convertusers = lambda x:[str(y) for y in x]

        for i,j in enumerate(allusers,1):
            print("{}){}".format(i," ".join(convertusers(j))))


    def deleteusers(self):
        self.cls_()
        self.cursor.execute("SELECT * FROM deger")

        allusers = self.cursor.fetchall()

        convertusers = lambda x:[str(y) for y in x]

        for i,j in enumerate(allusers,1):
            print("{}){}".format(i," ".join(convertusers(j))))
        try: 
            while True:
                    select = int(input(": "))
                break
        except ValueError:
            print("Invalid Value.Try Again")

        
        
        self.cursor.execute("SELECT * FROM deger WHERE id = '{}'".format(select))
        data = self.cursor.fetchone()
        while True:
            print(Fore.GREEN)
            sure = input("Are you sure you want to delete {}?(Y/N)".format(data[0]))
            print(Style.RESET_ALL)
            if sure == "E" or sure == "H":
                if sure == "E":
                    print(Fore.GREEN)
                    print("User named {} has been deleted.".format(data[0]))
                    print(Style.RESET_ALL)
                    self.cursor.execute("DELETE FROM deger WHERE id = '{}'".format(select))
                    self.connect.commit()
                    bekle(4)
                    self.admin()
                    break
                else:
                    print(Fore.RED)
                    print("User not deleted.")
                    print(Style.RESET_ALL)
                    self.admin()
                    break
            else:
                print("Invalid Value!Try Again.")
        return select

    def updateusers(self):
        pass

    def activate(self):
        pass



    def mainmenu(self):
        print(Fore.GREEN)
        print("          *************\n          * L o g i n *\n          *************")

    def choice(self):
        print(Style.RESET_ALL)
        while True:
            try:
                choice = int(input("1-Log In\n2-Sign In\n3-Forget\n4-Exit\nChoice: "))
                if choice < 1 or choice > 4:
                    print(Fore.RED)
                    print("Error.Try again.")
                    print(Style.RESET_ALL)
                else:
                    break
            except ValueError:
                print(Fore.RED)
                print("Invalid value.Try again.")
        return choice

    def login(self):
        self.cls_()
        denemehakki = random.randint(3, 5)
        while True:
            username = input("Username: ")
            password = input("Password: ")
            self.cursor.execute("SELECT * FROM deger WHERE kullaniciadi = '{}' AND sifre = '{}'".format(username,password))
            data = self.cursor.fetchone()
            if data:
                if data[7] == "A":
                    print(Fore.GREEN)
                    print("Welcome {} Admin!".format(data[0]))
                    print(Style.RESET_ALL)
                    bekle(2)
                    self.cls_()
                    self.admin()
                    break
                elif data[5] == "P":
                    print("Your account is not active!")
                else:
                    print(Fore.GREEN)
                    print("Welcome {}!".format(data[0]))
                    bekle(2)
                    self.cls_()
                    break
            else:
                denemehakki -= 1
                print(Fore.RED)
                print("Username or Password is wrong.Try Again")
                print(Style.RESET_ALL)
                bekle(2)
                self.cls_()
                if denemehakki == 0:
                    self.status = False

    def signin(self):
        self.cls_()
        user = "U"
        status = "A"
        username = input("Username: ")
        password = input("Password: ")
        email = input("E-Mail: ")
        explanation = input("Explanation: ")
        while True:
            id = random.randint(1111,9999)
            verify = random.randint(111111,999999)
            self.cursor.execute("SELECT * FROM deger WHERE id = '{}'".format(id))
            data = self.cursor.fetchone()
            if data:
                pass
            else:
                break
        self.cursor.execute("INSERT INTO deger VALUES('{}','{}','{}','{}','{}','{}','{}','{}')".format(username,password,email,id,explanation,status,verify,user))
        print(Fore.GREEN)
        print("Session saved as: {},{},{},{}".format(username,password,email,explanation,))
        print("Your id: {}".format(id))
        print("Your verify code: {}".format(verify))
        self.connect.commit()
        print(Style.RESET_ALL)
        bekle(10)
        self.cls_()
        self.run()

    def forget(self):
        self.cls_()
        p = "P"
        pasifhak = 2
        while True:
            username = input("Username: ")
            verify = input("Verify code: ")
            self.cursor.execute("SELECT * FROM deger WHERE kullaniciadi = '{}' AND verify = '{}'".format(username,verify))
            data = self.cursor.fetchone()
            if data:
                newPassword = input("New Password: ")
                self.cursor.execute("UPDATE deger SET sifre = '{}' WHERE id = '{}'".format(newPassword,data[3]))
                self.connect.commit()
                print(Fore.GREEN)
                print("Password cahange succesfull!")
                bekle(2)
                break
            else:
                pasifhak -= 1
                print(Fore.RED)
                print("Username or verification code is wrong.Try Again.")
                bekle(2)
                self.cls_()
                if pasifhak == 0:
                    self.cursor.execute("UPDATE deger SET durum= '{}' WHERE kullaniciadi = '{}'".format(p,username))
                    self.connect.commit()
                    self.status = False
                    break

    def connectDB(self):
        self.connect = sqlite3.connect("a.db")
        self.cursor = self.connect.cursor()
        self.cursor.execute("CREATE TABLE IF NOT EXISTS deger(kullaniciadi,sifre,eposta,id,aciklama,durum,verify,admin)")
        self.connect.commit()

    def cls_(self):
        os.system('cls')
                                  

login = Login("Test")
while login.status:
    login.run()

Soru Sorarken Sıkça Düşülen Hatalar #9

2 Beğeni
***select = int(input(": "))***

Syntaxta sorun var yıldız işaretlerini kaldırınca kod sorunsuz çalışır vaziyette.

1 Beğeni

Onu forumda postu açarken vurgulaya tıkladım o yıldızlar oyüzden var

Admin panelde delete users seçildikten sonra id yi girince problem çıkarmıyor bende.
Kullanıcıyı kaydederken rastgele bir id oluşturuyorsun.Silme fonksiyonunda da bu id’yi istiyorsun.
Örnek bir kullanıcı ekledim ve 9700 gibi bir id verdi.Ardından admin panelde silme fonksiyonunu çağırdım.9700 id’sini girdim.Onaylıyor musun mesajı geldi ve “E” seçerek silebildim.
Kodlarında herhangi bir hata yok.Select input alanında doğru id yazman gerekiyor sadece.Bu id’yi de veritabanını DBbrowser ile açıp içerisinden bakıp kontrol ederek denedim.Eğer farklı bir şey soruyor ya da isityorsan belirtebilirsin belki ben istediğini tam anlayamamışımdır.

Direkt id yazacağım yerde sorunum var inputu hiç bir türlğ gösteremedim