簡體   English   中英

為什么在初始化期間這是python語法錯誤?

[英]Why is this a python syntax error during an initialisation?

這段代碼:

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))

產生語法錯誤,最后一行上的小箭頭指向todo_list

TodoList__init__方法在這里:

def __init__(self, json_location):
    """
    Sets up the list.
    """
    self.json_location = json_location
    self.load()

我是Python的新手,所以在這里看不到我做錯了什么。

您需要關閉此)

text = ''.join(sys.argv[3:]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM