syntax error in python:

Posted by pecker on Stack Overflow See other posts from Stack Overflow or by pecker
Published on 2010-06-14T12:01:27Z Indexed on 2010/06/14 12:12 UTC
Read the original article Hit count: 273

Filed under:

Hello,

I'm learning python. It gives syntax error in this script. I'm unable to figure out.

import exceptions
class FOUND(Exception): pass
x = [1,2,3,4,56,73,29,35,12,32,63,12,76,75,89]


while True:
    test = int(raw_input('Enter integer to be checked in list:'))
    try:
        count = -1
        for y in x:
            count += 1
            if y == test:
                raise FOUND
    except ValueError,e:
        print "Not a valid integer (%d)"%(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 " "

Invalid syntax & it highlights comma in this line: 'except ValueError,e:'

© Stack Overflow or respective owner

Related posts about python