from threading import Thread
from time import sleep


def fun():
    sleep(3)
    print("Daemon 测试")


t = Thread(target=fun)

t.setDaemon(True)
# or
t.daemon = True
print(t.isDaemon())
t.start()

print("主线程结束")


if __name__ == '__main__':
    pass
