def data(self):
conn = sqlite3.connect('qlcsnv.db')
myCursor = conn.cursor()
myCursor.execute("Select *from csnv")
row=myCursor.fetchall()
print(len(row))
我想在標簽上顯示 print(len(row)) :
self.data2=Label(self.frame4,text="T?NG: " self.data(),font=('Time New Roman', 9, 'bold'), fg='black', bg='#D0C4DE')
self.Tongdata2.place(x=5, y=40, width=70)
但在標簽上顯示:資料:無
uj5u.com熱心網友回復:
您沒有從 回傳任何內容data(),您只是將其列印到控制臺中,因此self.data()回傳None. 嘗試
def data(self):
conn = sqlite3.connect('qlcsnv.db')
myCursor = conn.cursor()
myCursor.execute("Select *from csnv")
row=myCursor.fetchall()
return len(row)
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/325070.html
上一篇:如何在sqlite中組合一列?
下一篇:在SQLite中檢查數字約束
