这段代码:
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
最后一行。
的__init__
方法在TodoList
这里:
def __init__(self, json_location):
"""
Sets up the list.
"""
self.json_location = json_location
self.load()
我对 Python 有点陌生,所以我看不出我在这里做错了什么。