python - Python check number is less than
问题描述
if uservar[0][0] == text_hashed:
sql = "SELECT expires FROM akeys WHERE user = %s"
var = (message.author.id,)
mycursor.execute(sql, var)
myresultrank = mycursor.fetchall()
guild = client.get_guild(CENSORED)
if myresultrank < 1:
print("Less")
else:
print("Normal")
sql = """UPDATE akeys SET user = %s WHERE license = %s"""
val = (message.author.id, text_hashed)
mycursor.execute(sql, val)
mydb.commit()
Im trying to check if the number in the data base is less than 1 but i get this error
await coro(*args, **kwargs)
File "My Path", line 529, in
on_message
if myresultrank < 1:
TypeError: '<' not supported between instances of 'list' and 'int'
解决方案
试试这些改变
myresultrank = mycursor.fetchone()
. . .
if myresultrank[0] < 1:
推荐阅读
- javascript - 尝试为我想要的聚合解析二维 JSON 数组
- python - GCP 使用 Python 获取自定义 IAM 角色权限
- python - 有人可以帮我解决 Flask 的这个问题吗
- amazon-web-services - 搜索根据注释过滤的 AWS X-ray
- virtual-machine - 我尝试在 VirtualBox 中安装 Arista vEOS,但出现此错误:“未找到启动配置”
- java - 推土机:成功转换后用源值覆盖的字段
- sql - 获取具有最大值的行的最有效方法是什么?
- python - UDP 客户端/服务器类型错误
- javascript - Vue 组件默认数据值覆盖了我在 beforeRouteUpdate 中设置的值
- javascript - 如何调整 Idea Intellij Ultimate 使其不会在 16GB 主机上崩溃?