None: E -6ren">
gpt4 book ai didi

python - 摆脱语法错误 : invalid syntax in Python

转载 作者:太空宇宙 更新时间:2023-11-03 12:53:08 24 4
gpt4 key购买 nike

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

不知道这里发生了什么..

代码:

 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)

最佳答案

由于您使用的是 Python 2.7,因此您需要恢复到该语法。类型提示是 Python 3;删除它们。

def success(self, input1="", input2="", input3=""):

关于python - 摆脱语法错误 : invalid syntax in Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54101244/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com