【发布时间】:2009-12-23 21:34:05
【问题描述】:
这段代码:
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 有点陌生,所以我看不出我在这里做错了什么。
【问题讨论】:
标签: python syntax syntax-error