thread2_add_thread.py 582 B

1234567891011121314151617181920
  1. # View more python learning tutorial on my Youtube and Youku channel!!!
  2. # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
  3. # Youku video tutorial: http://i.youku.com/pythontutorial
  4. import threading
  5. #def main():
  6. # print(threading.active_count())
  7. # print(threading.enumerate()) # see the thread list
  8. # print(threading.current_thread())
  9. def thread_job():
  10. print('This is a thread of %s' % threading.current_thread())
  11. def main():
  12. thread = threading.Thread(target=thread_job,)
  13. thread.start()
  14. if __name__ == '__main__':
  15. main()