#!/usr/bin/env python
import multiprocessing
import time
# print "The time is {0}".format(time.ctime())
# print time.ctime()
# print "The time is {0}".format
# print ‘this is {}‘.format(‘pangf‘)
# print ‘that is {0},{1}‘.format(‘hello‘,‘world‘)
# print ‘that is {1},{0},{2}‘.format(‘name‘,‘fdf‘,‘000‘)
# print time.ctime()
# print ‘that is {name}‘.format(name=‘pdbbb‘)
def worker(interv):
n = 5
while n>0:
print ‘the time is {}‘.format(time.ctime())
time.sleep(interv)
n -= 1
if __name__ == ‘__main__‘:
p = multiprocessing.Process(target = worker,args = (3,))
p.start()
print "p.pid:",p.pid
print ‘p.is_alive:‘,p.is_alive()
# pass
时间: 2024-10-12 20:36:30