Python大佬们帮我看看

又报错了
UNIQUE constraint failed: tongxunlu.usernum

import sqlite3
def opendb():
conn = sqlite3.connect("d:\mydb.db")
cur = conn.execute("""create table if not exists tongxunlu(usernum integer primary key,username varchar(128),password varchar(128))""")
return cur,conn
def showalldb():
print("处理后的数据")
hel = opendb()
cur = hel[1].cursor()
cur.execute("select * from tongxunlu")
res = cur.fetchall()
for lin in res:
for h in line:
print(h),
print
cur.close()
def into():
usernum = input("请输入学号")
username1 = input("请输入姓名")
password1 = input("请输入密码")
return usernum,username1,password1
def adddb():
welcome = """欢迎使用添加数据功能"""
print(welcome)
person = into()
hel = opendb()
hel[1].execute(" insert into tongxunlu ( usernum, username, password)values (?,?,?)",(person[0],person[1],person[2],))
hel[1].commit()
print("恭喜,添加数据成功")
showalldb()
hel[1].close()
def deldb():
welcome = "欢迎使用删除功能"
print(welcome)
delchoice = input("请输入想删除的学号")
hel = opendb()
hel[1].execute("delete from tongxunlu where username ="+delchoice)
hel[1].commit()
print("删除成功")
showalldb()
hel[1].close()
def alter():
welcome = "欢迎使用修改功能"
print(welcome)
changechoice = input("请输入学号")
hel = opendb()
person = into()
hel[1].execute("update tongxunlu set usernum =?,username =?,password = ? where usernum = "+ changechoice,(person[0],person[1],person[2]))
hel[1].commit()
showalldb()
hel[1].close()
def searchdb():
welcome = "欢迎使用查询功能"
print(welcome)
choice = input("请输入学号")
hel = opendb()
cur = hel[1].cursor()
cur.execute("select * from tongxunlu where usernum = "+ choice)
hel[1].commit()
print("数据如下")
for row in cur:
print(row[0],roe[1],row[2])
cur.close()
hel[1].close()
def conti(a):
choice = input("是否继续")
if choice == 'y':
a = 1
else:
a = 0
return a
if name == "__main__":
flag = 1
while flag:
welcome = "欢迎使用数据库"
print(welcome)
choiceshow = """
请选择:
(添加)添加
(删除)删除
(修改)修改
(查询)查询
选择您的操作:
"""
choice = input(choiceshow)
if choice =="添加":
adddb()
conti(flag)
elif choice =="删除":
deldb()
conti(flag)
elif choice =="修改":
alter()
conti(flag)
elif choice =="查询":
searchdb()
conti(flag)
else:
print("输入错误")
print("请重新出入")

https://www.runoob.com/python/python-mysql.html

对tongxunlu.usernum,你设置了主键或者unique限制,导致无法同时存在两条tongxunlu.usernum值相同的记录,检查你插入的数据,再尝试