TypeError: argument of type 'int' is not iterable? What does it mean?
TypeError: argument of type 'int' is not iterable? What does it mean?
ClassNames = studentname and score
if studentname not in ClassNames:
ClassNames = ClassNames.append(studentname)
for studentname in filename and ClassNames <= 3:
FirstResult.append(score)
SecondResult.append|(score)
ThirdResult.append(score)
if
行给我错误:
TypeError: argument of type 'int' is not iterable
您的 ClassName
是布尔运算 和 的结果,因此它可以取值 True 或 False(0 或 1)。因为它是不可迭代的类型,所以你会收到这个错误。
重新考虑要在 ClassName
中保留哪些数据。
ClassNames = studentname and score
最有可能将变量 ClassNames
设置为 score
,这听起来像是 int
.
通过调用
if studentname not in ClassNames:
...
您遍历 ClassNames
以找到 studentname
,但正如您的错误所说,int
不可迭代。
更多问题:
list.append()
就地工作,returns None
ClassNames <= 3
只有在 int
才有意义
ClassNames = studentname and score
if studentname not in ClassNames:
ClassNames = ClassNames.append(studentname)
for studentname in filename and ClassNames <= 3:
FirstResult.append(score)
SecondResult.append|(score)
ThirdResult.append(score)
if
行给我错误:
TypeError: argument of type 'int' is not iterable
您的 ClassName
是布尔运算 和 的结果,因此它可以取值 True 或 False(0 或 1)。因为它是不可迭代的类型,所以你会收到这个错误。
重新考虑要在 ClassName
中保留哪些数据。
ClassNames = studentname and score
最有可能将变量 ClassNames
设置为 score
,这听起来像是 int
.
通过调用
if studentname not in ClassNames:
...
您遍历 ClassNames
以找到 studentname
,但正如您的错误所说,int
不可迭代。
更多问题:
list.append()
就地工作,returnsNone
ClassNames <= 3
只有在int
才有意义