程序中的executecommand函数接受输入mydoc并打印输入。
当程序运行时,它正是这样做的。以下给定示例中的输入hello被视为函数executecommand的输入。此函数打印
hello
并返回到调用程序main,然后由于没有更多语句而终止。
>>> def executeCommand(myDoc):
... print(myDoc)
... return
...
>>> def insert():
... print("insert command:")
... return
...
>>> def delete():
... print("delete command:")
... return
...
>>> def main():
... print("Functional Text Editor ")
... executeCommand(input("Type in file name: "))
...
>>> if __name__ == '__main__':
... main()
...
Functional Text Editor
Type in file name: hello
hello
>>>