我想同时执行以下两个功能。
from multiprocessing import Process
import os
import datetime
def func_1(title):
now = datetime.datetime.now()
print "hello, world"
print "Current second: %d" % now.second
print "Current microsecond: %d" % now.microsecond
def func_2(name):
func_1('function func_2')
now = datetime.datetime.now()
print "Bye, world"
print "Current second: %d" % now.second
print "Current microsecond: %d" % now.microsecond
if __name__ == '__main__':
p = Process(target=func_2, args=('bob',))
p.start()
p.join()
而且我得到了微秒的差异。有没有办法同时执行两者?任何帮助,将不胜感激。