我正在建立一个简单的程序,为我的租赁物业预先筛选租户。程序会问他们一系列问题,其中一些问题需要回答“是”或“否”,这将是布尔值(真/假)。在
问题是,不管你回答什么,它记录为“1”的布尔输入。在
我在本地使用sqlite3存储数据,代码如下:def enter_dynamic_data():
fname = input("First Name? ")
lname = input("Last Name? ")
email = input("Email? ")
phone = input("Phone? ")
criminal = bool(input("Have you ever been convicted of a crime? "))
evicted = bool(input("Have you ever been evicted? "))
income = bool(input("Do you have verifiable income of at least 3x the rent amount? "))
ref = bool(input("Do you have good rental references? "))
c.execute("INSERT INTO tenant_screening (firstname, lastname, email, phone, criminal, evicted, income, ref) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", (fname, lname, email, phone, criminal, evicted, income, ref))