1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#! python3 # threadDemo.py import time import threading print('Start of program.') def takeANap(): time.sleep(5) print('Wake up!') threadObj = threading.Thread(target=takeANap) threadObj.start() print('End of program.')