Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Rid of SyntaxError: invalid syntax in Python

def success(self, input1: str = "", input2: str = "", input3: str = "") -> None:
E                               ^
E   SyntaxError: invalid syntax

No idea what is happening here..

Code:

 def success(self, input1: str = "", input2: str = "", input3: str = "") -> None:
        input1 = str(input1)
        input2 = str(input2)
        input3 = str(input3)
        print(Color.BOLD + Color.GREEN + " " + Color.CHECKMARK + " " + input1 + Color.END + " " + input2 + " " + input3)
like image 774
stevek-pro Avatar asked Jun 13 '26 03:06

stevek-pro


1 Answers

Since you're on Python 2.7, you need to back up to that syntax. Type hints are Python 3; remove them.

def success(self, input1="", input2="", input3=""):
like image 83
Prune Avatar answered Jun 15 '26 17:06

Prune



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!