进程已结束,退出代码1
问题;代码运行中途出错,已经打印出了前面没有出错的结果了,修改出错的代码后,不能接着运行吗?把result_3修改成result_1后,打印结果只能重新运行(打印a结果接着打印result_1结果接着打印result_2的结果,),不能接着打印result_2的结果。出错前已经打印好a和result_1的结果了,修改好代码好不能接着直接打印result_2结果,只能重新计算打印。请问python中,已经打印好几个结果,中途代码报错,修改好后怎么才能接着打印后面的结果,而不是从头运行,那样太浪费了时间
不知道你这个问题是否已经解决, 如果还没有解决的话:glossary = {
'string': 'A series of characters.',
'comment': 'A note in a program that the Python interpreter ignores.',
'list': 'A collection of items in a particular order.',
'loop': 'Work through a collection of items, one at a time.',
'dictionary': "A collection of key-value pairs.",
}
word = 'string'
print("\n" + word.title() + ": " + glossary[word])
word = 'comment'
print("\n" + word.title() + ": " + glossary[word])
word = 'list'
print("\n" + word.title() + ": " + glossary[word])
word = 'loop'
print("\n" + word.title() + ": " + glossary[word])
word = 'dictionary'
print("\n" + word.title() + ": " + glossary[word])
importlib 动态加载可以避免每次重启生效