I'm trying to build a database for phone contacts in python but i still get this error when using sqlite3

Viewed 18
import sqlite3

connection = sqlite3.connect("ContactsDatabase.db")
cursor = connection.cursor()

cursor.execute(
    "Create table ContactsDatabase (contact_name text, contact_adress text, contact_phone_number integer, contact_email text)")


class Contact_Book:
    contact_name = str(input("Contact Name: ")).capitalize()
    contact_adress = input("Contact Adress: ").capitalize()
    contact_phone_number = int(input("Contact Phone Number: "))
    contact_email = input("Contact Email Adress: ")

    def name(self):
        self.name = Contact_Book.contact_name
        return self.name

    def adress(self):
        self.adress = Contact_Book.contact_adress
        return self.adress

    def phone_number(self):
        self.phone_number = Contact_Book.contact_phone_number
        return self.phone_number

    def email(self):
        self.email = Contact_Book.contact_email
        return self.email

    def contact_list(self):
        return [(self.name, self.adress, self.phone_number, self.email)]


contact = Contact_Book()

cursor.execute(
    "insert into ContactsDatabase values (?,?,?,?)", contact.contact_list())
connection.close()

This is what error i get after running:

sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 4, and there are 1 supplied.

I've been stuck for some time so your help might be handy!

0 Answers
Related