21fsdsd 发表于 2016-9-20 10:41:24

python字符串format

#!/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

页: [1]
查看完整版本: python字符串format