模式模块共轭:attributeRor:“int”对象没有属性“lower”

2024-03-29 08:28:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用模式包编写一个扩展的共轭函数。例如,当尝试使用下列元组对动词allege进行共轭时:

 tuple = ('allege', 3, 'future', 'plural', 'subjunctive', 'progressive', False)

我得到了AttributeError: 'int' object has no attribute 'lower'.

当我打印元组项时,它们会很好地打印出来,即使是元组的整数项,但是当我尝试在共轭函数中使用它们时,如下所示:

 conjugate(tuple[0], tuple[1], tuple[2], tuple[3], tuple[4], tuple[5], tuple[6])

我得到了AttributeError: 'int' object has no attribute 'lower'错误,不能在conjugate()函数中使用它。

有人能帮我解决这个问题吗。


Tags: 函数noobject模式attribute动词lowerint