擅长:python、mysql、java
<p>你能这样做吗?我不知道你这么做的真正原因,但是接受用户输入并添加到列表中就可以了。在</p>
<pre><code>def main():
prevMove = []
choice = ''
def getHistory():
print prevMove
while True:
choice = raw_input("> ")
if choice == '':
break
prevMove.append(choice)
# do whatever you want with the input here
# a call to history
getHistory()
if __name__ == "__main__":
main()
</code></pre>
<hr/>
<p>编辑:</p>
<p>由于问题编辑,代码现在将记录事件的历史,并具有获取它们的函数。在</p>