python代码:
import time import traceback from threading import Thread def fun1(): fun1_1() def fun2(): t = Thread(target=fun2_1()) t.start() def fun1_1(): print('fun1_1') def fun2_1(): 1 / 0 def main(): while True: try: time.sleep(1) fun1() fun2() except Exception: traceback.print_exc() if __name__ == '__main__': main()View Code
效果图:
标签:__,fun1,fun2,python,捕获,报错,import,main,def From: https://www.cnblogs.com/wusenwusen/p/18258617