gpt4 book ai didi

python - python : 语法错误

转载 作者:太空宇宙 更新时间:2023-11-03 12:52:08 25 4
gpt4 key购买 nike

<分区>

我正在学习 python。它在此脚本中给出语法错误。我想不通。

import exceptions
class FOUND(Exception): pass

x = [1,2,3,4,56,73,29,35,12,32,63,12,76,75,89]


while True:

try:
test = int(raw_input('Enter integer to be checked in list:'))
count = -1
for y in x:
count += 1
if y == test:
raise FOUND
except ValueError as e:
print "Not a valid integer (%s)"%(e)
except FOUND:
print "Found (%d) at (%d)"%(test,count)
else:
print "Not found ,Appending (%d) to list at location (%d)"%(test,count+1)
x.append(test)
finally:
print "The List:"
print x
print " "

语法无效 & 它突出显示了此行中的右双引号:print "Not a valid integer (%s)"%(e)

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com