使用if-condition检查文件名

ran*_*psp 1 python syntax-error

我在Python中犯了一个真正的愚蠢的错误,却无法找到它是什么

我在python中做这样的事情

filename="file1"
if name == 'file1'
    print 1
Run Code Online (Sandbox Code Playgroud)

我收到了无效的语法错误

Joh*_*ooy 7

你错过了冒号

filename="file1"
if name == 'file1':
    print 1
Run Code Online (Sandbox Code Playgroud)