大佬教程收集整理的这篇文章主要介绍了从表中抓取数据时出现 SQLite 错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
对不起,如果我在这里发布图片而不是代码,已经过了一天。
所以我试图使用这个函数来保存一个字符串和一个整数值作为用户名和一个点值(这是一个愚蠢的不和谐机器人)。
所以问题是我试图检查这个保存的数据是否已经存在,但由于某种原因,我收到错误“无类型”是不可编写脚本的。我正在尝试检查它是否没有,如果是,则进行输入,如果没有则更新条目。
我已经尝试这样做了好几天了。对不起,如果我感到困惑,如果您需要更多信息,请提出问题! Adhd 今天很糟糕,所以我有点分散,但我需要答案enter image description here
cur.execute('SELECT * FROM nice_words')
niceWords_temp = cur.fetchall()
niceWords = [''.join(item) for item in niceWords_temp]
cur.execute('SELECT MeanWords FROM mean_words')
meanWords_temp = cur.fetchall()
meanWords = [''.join(item) for item in meanWords_temp]
cur.execute('SELECT * FROM nice_responses')
responseSecretionNice_temp = cur.fetchall()
responseSecretionNice = [''.join(item) for item in
responseSecretionNice_temp]
cur.execute('SELECT * FROM mean_responses')
responseSecretionMean_temp = cur.fetchall()
responseSecretionMean = [''.join(item) for item in responseSecretionMean_temp]
anus = discord.ClIEnt()
#saving user data
temp_adore_points = 0
temp_nice_tokens = 0
temp_mean_tokens = 0
def saving_the_user_data_for_messaging(user,isNice=TruE):
#casTing user as a String
user = str(user)
temp_user = cur.execute('SELECT user FROM saving_user_data WHERE User = (?)',(user,)).fetchone()[0]
print(temp_user)
#checking if the user was saved before
if temp_user is None:
adorePoints = 0
if isNice:
adorePoints = adorePoints + 1
else:
adorePoints = adorePoints - 1
cur.execute('INSERT INTO saving_user_data (User,KevinsAdorationPoints) values (?,0)',))
#insert in one,update in another
else:
temp_adore_points = cur.execute('SELECT KevinsAdorationPoints FROM saving_user_data WHERE User = (?)',)).fetchone()
adorePoints = temp_adore_points[0]#make this a mofocin Integer somehow
if isNice:
adorePoints = adorePoints + 1
else:
adorePoints = adorePoints - 1
cur.execute('updatE saving_user_data SET KevinsAdorationPoints = ? WHERE User = ?',(adorePoints,user,))
cur.execute('SELECT * FROM saving_user_data')
print(cur.fetchall())
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的从表中抓取数据时出现 SQLite 错误全部内容,希望文章能够帮你解决从表中抓取数据时出现 SQLite 错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。