Python 3.x 使用Sqlite3在Python中获取每周信息

Python 3.x 使用Sqlite3在Python中获取每周信息,python-3.x,sqlite,function,Python 3.x,Sqlite,Function,我有一个存储每日数据的表,通过这个函数,我想获得从(yyyy,m,d)到(yyy,m,d)的数据量 该函数应返回输入日期范围内的小时数总和。代码未显示任何错误,运行代码后,我也未收到任何错误。但是标签或数据将不会显示在屏幕上。PS:当我使用这行代码而不是那行代码时,我已经让所有的代码都能正常工作了。。。。cursor.execute(“从工作时间表中选择sum(fnishing-start),其中日期介于?和?,(datetime.date(yyyy,m,d),datetime.date(yyy

我有一个存储每日数据的表,通过这个函数,我想获得从(yyyy,m,d)到(yyy,m,d)的数据量


该函数应返回输入日期范围内的小时数总和。代码未显示任何错误,运行代码后,我也未收到任何错误。但是标签或数据将不会显示在屏幕上。

PS:当我使用这行代码而不是那行代码时,我已经让所有的代码都能正常工作了。。。。cursor.execute(“从工作时间表中选择sum(fnishing-start),其中日期介于?和?,(datetime.date(yyyy,m,d),datetime.date(yyyy,m,d))。。。。但是我应该从我的输入框中获取日期。更改:
duu\u Entry和du\u Entry
duu\u Entry+”和“+du\u Entry
”。并在末尾添加一个空格:
其中日期介于“
”之间。我尝试了您的解决方案,但返回了一个错误。文件“C:\Programming\PYTHON\test projects\working time 1.3\cal\u win.py”,第21行,在每周校准游标中。执行(“从工作时间应用程序表中选择总和(fnishing-start),其中日期介于“+sqlite3.OperationalError:near”和“:syntax error”之间。您连接字符串,对吗?
应该是连接在两个日期之间的字符串:d_f_条目和d__条目。
enter code here
def weekly_cal():
    connect = sqlite3.connect('working_time_app.db')
    cursor = connect.cursor()

    cursor.execute("SELECT sum( fnishing - starting ) FROM working_time_app_table WHERE date between" +
                   d_u_entry and d_f_entry)
    # ( d_u_entry ) and (d_f_entry) are variables which the Dates are stored in and i got those inputs 
    # from an entry box
    sum_result = cursor.fetchall()

    show_weekly_cal_label = Label(cal_win, text=sum_result, font=("mv boli", 12), fg="white", bg="black")
    show_weekly_cal_label.grid(column=3, row=15, columnspan=5)

    connect.commit()
    connect.close()