<filename>thread/daemon.py
import threading
import time
import logging

logging.basicConfig(level=logging.DEBUG,format='(%(threadName)-10s) %(message)s',)

def daemon():
    logging.debug('starging')
    time.sleep(5)
    logging.debug('exiting')

d=threading.Thread(name='daemon',target=daemon)
d.setDaemon(True)

def non_daemon():
    logging.debug("Starting")
    logging.debug("Exiting")

t=threading.Thread(name="non-daemon",target=non_daemon)

d.start()
t.start()

d.join(1)
print("d.isAlive ? ",d.isAlive())
t.join()
<filename>thread/daemon.py
import threading
import time
import logging

logging.basicConfig(level=logging.DEBUG,format='(%(threadName)-10s) %(message)s',)

def daemon():
    logging.debug('starging')
    time.sleep(5)
    logging.debug('exiting')

d=threading.Thread(name='daemon',target=daemon)
d.setDaemon(True)

def non_daemon():
    logging.debug("Starting")
    logging.debug("Exiting")

t=threading.Thread(name="non-daemon",target=non_daemon)

d.start()
t.start()

d.join(1)
print("d.isAlive ? ",d.isAlive())
t.join()