- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这里遇到的问题是,每当我尝试将数据输入我的用户名输入框 (self.KUEntry.get()
) 并在我的查询中运行该输入框时,它返回 none 并抛出问题中列出的错误。
该函数应该检查注册用户存储的 salt 和哈希值,并将其与他们在输入框中输入的密码进行比较。
def login_verification(self):
username = self.KUEntry.get()
print username
cursor1.execute = ("SELECT salt FROM User WHERE username = (%s)", username)
salty = cursor1.fetchone() [0]
print salty
cursor2.execute = ("SELECT PashHash FROM User WHERE username = %s", (username))
hashy = cursor2.fetchone() [0]
print hashy
test = hashlib.sha512(username + salty).hexdigest
print test
if test == hashy:
self.mainscreen
else:
print "incorrect password"
最佳答案
像这样放置我的代码可以修复回溯错误,但它不会返回预期的结果。而不是我的 cursor1.fetchone 和 cursor2.fetchone 方法返回查询结果,它们返回“无”。
def login_verification(self):
username = self.KUEntry.get()
print username
cursor1.execute = ("SELECT salt FROM User WHERE username = %s", str(username))
salty = str(cursor1.fetchone())
print salty
cursor2.execute = ("SELECT PashHash FROM User WHERE username = %s", str(username))
hashy = str(cursor2.fetchone())
print hashy
test = hashlib.sha512(username + str(salty)).hexdigest
print test
if test == hashy:
self.mainscreen
else:
print "incorrect password"
关于python - 类型错误 : 'NoneType' object has no attribute '__getitem__' tkinter error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43751328/
当 __getitem__ 映射到内部序列类型时,以下哪一项是推荐的执行方式? class A: def __init__(self, ...): ... se
这是我在leetcode中遇到的问题。您将看到两个非空链接表,表示两个非负整数。数字以相反的顺序存储,并且它们的每个节点都包含一个数字。将这两个数字相加,然后以链表的形式返回总和。。你可以假设这两个数
我正在通过继承 torch.utils.data.Dataset 创建一个数据集类并遇到了以下问题。 与返回固定类型值的先前函数不同,__getitem__没有。例如, class MyExample
我有一个自定义类Field的对象,它本质上包裹着一个numpy.ndarray对象。该对象由两个输入定义:一个值数组 (values) 和一个切片对象 (segment),该对象定义这些值应放置在某个
我有一个简单的问题,这行代码 row[time] == numbers[num_time]: 给我错误: int has no attribute __getitem__ 经过一些研究,我发现当您尝试
我是 python 的初学者,正在尝试通过测试 test_pic 和包含图像的数据库来查找图像之间的相似性。我已经从目录传递了图像并使用 SIFT 功能对其进行了比较 from PIL import
这是 Python 在切片中传递负数的行为示例: >>> class test: ... def __getitem__(self, sl): ... print sl.st
我正在制作一个树类,我想要 __getitem__方法来获取元组参数,所以我这样使用它: t[1, 2, 3] 但是,当我想获取根值时,我需要给它一个空元组,当我这样做时 t[] 我收到语法错误: >
我正在创建一个表示列表列表的类。 __getitem__ 让我头疼。在我将切片作为参数引入之前,一切都进行得很顺利。 演示代码 # Python version 2.7.5 class NestedL
序列(例如列表)的方法 __getitem__() 可以返回单个项目或项目序列。例如,给定下面的函数装饰: def __getitem__(self, index) -> Union[Product,
我正在编写基本的 PSO(粒子群优化),并且一直收到此错误,即粒子实例没有属性 __getitem__。我认为一切都很好,但 article 类似乎有一些错误。看一下 article 类。 from
我无法理解我收到此错误 -> 实例方法没有属性 getitem。我只是想抓取这个网站以提取部门名称。 import scrapy from scrapy.contrib.spiders import
你好,StackOverflowers, 我正在实现一个二叉搜索树,其接口(interface)与 Python 中的 dict 几乎相同(在有人问之前,我这样做是为了好玩,没有生产代码)。 为了从我
这个问题在这里已经有了答案: How to inherit and extend a list object in Python? (4 个答案) 关闭 5 个月前。 我正在尝试定义一个默认样式列表
我为使用列表列表的 connect 4 游戏创建了一个 Board 类。我想让对象支持对面板的行和列进行索引: class Test: def __init__(self, cols, row
有没有办法以支持整数和切片索引的方式实现 __getitem__ 而无需手动检查参数类型? 我看到了很多这种形式的例子,但我觉得它很老套。 def __getitem__(self,key): i
class Custom(type): @classmethod def __getitem__(cls, item): raise NotImplementedErr
我有这个代码: class A: def __init__(self): def method(self, item): print self, ":
python 中是否有一些内部的东西来处理传递给 __getitem_ 的参数 _ 不同,并自动将 start:stop:step 构造转换为切片? 下面是我的意思的演示 class ExampleC
我有两个这样的模型: class School(models.Model): name = models.CharField(max_length = 50) def __unicod
我是一名优秀的程序员,十分优秀!