1. format

def event_log(name, time):
    print('Event: {}, happens at {}'.format(name, str(time)))

2. 使用 + 连接符

def event_log(name, time):
    print('Event: ' + name + ', happens at ' + str(time))

3. 使用占位符

def event_log(name, time):
    print('Event: %s, happens at %s' % (name, str(time)))
posted on 2016-08-31 10:14  未雨愁眸  阅读(170)  评论(0编辑  收藏  举报