Python_2_Examples_and_Notes/16x_thread_2_func.py

18 lines
308 B
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
import threading
from threading import Thread
import time
def func1():
print 'Function 1'
time.sleep(2)
def func2():
print 'Function 2'
time.sleep(2)
if __name__ == '__main__':
Thread(target = func1).start()
Thread(target = func2).start()