I'm doing a real silly mistake in Python but unable to find what it is
I'm doing something like this in python
filename="file1"
if name == 'file1'
print 1
I'开发者_开发知识库m getting an invalid syntax error
You are missing a colon
filename="file1"
if name == 'file1':
print 1
You need to put a colon at the end of the if statment
filename="file1"
if name == 'file1':
print 1
what is name?? did you define it elsewhere?? I assume its "filename" instead, so
filename="file1"
if filename == 'file1':
print 1
if "name" is defined, then the problem is indeed the ":" at the end of "if" line.
精彩评论