diff --git a/pythonProject/.idea/other.xml b/pythonProject/.idea/other.xml new file mode 100644 index 0000000..2e75c2e --- /dev/null +++ b/pythonProject/.idea/other.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/pythonProject/__pycache__/dp.cpython-312.pyc b/pythonProject/__pycache__/dp.cpython-312.pyc index 4e91af8..65af147 100644 Binary files a/pythonProject/__pycache__/dp.cpython-312.pyc and b/pythonProject/__pycache__/dp.cpython-312.pyc differ diff --git a/pythonProject/dp.py b/pythonProject/dp.py index 0787d48..559bc61 100644 --- a/pythonProject/dp.py +++ b/pythonProject/dp.py @@ -63,6 +63,7 @@ class DBHelper: if __name__ == '__main__': db = DBHelper() sql = 'create table films(title varchar(50), actor varchar(200), time varchar(100));' - db.connect() + db.execute(sql, None) + db.close() logger.removeHandler(file_handler) diff --git a/pythonProject/films.py b/pythonProject/films.py index 177e8b6..6413c0d 100644 --- a/pythonProject/films.py +++ b/pythonProject/films.py @@ -34,10 +34,10 @@ def getPage(url): def insertInfo(item): db = dp.DBHelper() - _title = item['item'] + _title = item['title'] _actor = item['actor'] _time = item['time'] - sql = 'insert into films(title, actor, time) values (%s, %s, %s);' + sql = "insert into films(title, actor, time) values (%s, %s, %s);" params = (_title, _actor, _time) ok = db.execute(sql, params) diff --git a/pythonProject/films_log.txt b/pythonProject/films_log.txt new file mode 100644 index 0000000..e69de29 diff --git a/pythonProject/login.py b/pythonProject/login.py deleted file mode 100644 index 2594944..0000000 --- a/pythonProject/login.py +++ /dev/null @@ -1,57 +0,0 @@ -from tkinter import * - -user_login = { - 'aaa': '123', - 'bbb': '654' -} - -count = 0 - -def temp(s): - win = Tk() - win.geometry('100x100') - - message = Label(win, text=s) - message.pack() - -def login() : - global count - username = entry_username.get() - if username not in user_login: - label_message.config(text='账号错误') - else: - password = entry_password.get() - if password == user_login[username]: - #label_message.config(text='登录成功') - temp('登录成功') - - else: - label_message.config(text='密码错误!还可以尝试{}次'.format(2 - count)) - count += 1 - if count == 3: - temp('登陆失败') - btn_login.config(state='disabled') - -windon = Tk() -windon.title('用户登录') -windon.geometry('300x200') - -label_username = Label(windon, text='账号') -label_username.pack() - -entry_username = Entry(windon) -entry_username.pack() - -label_password = Label(windon, text='密码') -label_password.pack() - -entry_password = Entry(windon, show='*') -entry_password.pack() - -btn_login = Button(windon, text='登录', command=login) -btn_login.pack() - -label_message = Label(windon, text="") -label_message.pack() - -windon.mainloop()