python - Using if-condition to check filename -


I am making a real mistake in Python, but can not figure out what it is

  filename = "file1" if name == 'file1' print1  

I am getting an invalid syntax error

What's the name ?? Do you define it elsewhere? I instead consider "filename", so

if "name" is then

  filename = "file1" If defined, then the problem is actually "if" at the end of the line ":". 


Comments

Popular posts from this blog

.net - C# List<T>.Find(x=>x.Rectangle.Contains(Point)) FAIL -

iphone - Smoothing a rounded stroke in Core Graphics -

c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -