Con*_*Hen 0 python syntax if-statement syntax-error
for i in range(0,len(qList)):
    response=(input((stringify(aList[i])))
    if (response==cList[i]) or ((" "+response) in aList[i]):
其中cList是字符串列表,而aList是字符串列表的列表.stringify是一个辅助函数,它通过组合列表的元素来生成字符串.其中一个字符串前面有一个"".这样做的目的是允许用户输入一个数字(在cList中找到)或确切的文本(在aList的子列表中找到).
我真的不确定自己哪里出错了,说实话,我尝试了几件不同的事情.
您缺少前一行的右括号:
response=(input((stringify(aList[i])))
#        1     23         4        432 ?
无论如何,您正在使用这些括号中的许多括号,以下内容足够:
response = input(stringify(aList[i]))
if response == cList[i] or " " + response in aList[i]:
如果您尝试访问从元素aList,bList并cList在并行,可以考虑使用zip():
for a, b, c in zip(aList, bList, cList):
    response = input(stringify(a))
    if response == c or " " + response in a:
| 归档时间: | 
 | 
| 查看次数: | 51 次 | 
| 最近记录: |