syntax error in python

Tim Roberts timr at probo.com
Thu Feb 21 01:58:59 EST 2008


Lalit <lalitkrishna at gmail.com> wrote:

>Hi
>I am executing following commands.
>>>> test = os.path.isfile('c:\\src\\kasjdfl.txt')
>>>> print test
>True
>------------working fine but for below statement it is giving syntax
>error.
>
>>>> if (os.path.isfile('c:\\src\\kasjdfl.txt'))
>SyntaxError: invalid syntax
>
>any idea what is incorrect in my syntax

You know that this is not C, and that the parentheses are not needed in the
"if" statement?  In my opinion, they interfere with readability.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list