标签:time rar color 编程 date pre import logs cli
w
使用 Python 进行线程编程
https://www.ibm.com/developerworks/cn/aix/library/au-threadingpython/index.html
import threading import datetime class ThreadClass(threading.Thread): def run(self): now = datetime.datetime.now() print "%s says Hello World at time: %s" % (self.getName(),now) for i in range(2): t = ThreadClass() t.start()
C:\>python E:\MATHpyCLI\au-threadingpython.py Thread-1 says Hello World at time: 2017-04-29 15:07:00.141000Thread-2 says Hello World at time: 2017-04-29 15:07:00.143000 C:\>python E:\MATHpyCLI\au-threadingpython.py Thread-1 says Hello World at time: 2017-04-29 15:07:02.312000Thread-2 says Hello World at time: 2017-04-29 15:07:02.313000 C:\>python E:\MATHpyCLI\au-threadingpython.py Thread-1 says Hello World at time: 2017-04-29 15:07:03.116000 Thread-2 says Hello World at time: 2017-04-29 15:07:03.118000
标签:time rar color 编程 date pre import logs cli
原文地址:http://www.cnblogs.com/yuanjiangw/p/6785228.html