为什么在初始化期间这是一个python语法错误?

Mac*_*cha 0 python syntax syntax-error

这段代码:

class Todo:
    def addto(self, list_name="", text=""):
        """
        Adds an item to the specified list.
        """
        if list_name == "":
            list_name = sys.argv[2]
            text = ''.join(sys.argv[3:]

        todo_list = TodoList(getListFilename(list_name))
Run Code Online (Sandbox Code Playgroud)

产生语法错误,小箭头指向todo_list最后一行.

__init__对方法TodoList是在这里:

def __init__(self, json_location):
    """
    Sets up the list.
    """
    self.json_location = json_location
    self.load()
Run Code Online (Sandbox Code Playgroud)

我对Python很陌生,所以我不明白我在做错了什么.

jbo*_*chi 11

你需要关闭这个)

text = ''.join(sys.argv[3:]
Run Code Online (Sandbox Code Playgroud)

  • *Epic facepalm*.自我注意:解释器在定位语法错误方面不是很准确.下次检查更多细节. (2认同)