python tuple and dict arg

来源:互联网 发布:解可新最优化答案 编辑:程序博客网 时间:2024/06/05 00:26
def message(text,*line ,**head):
    for key in head.keys():
        print key+":"+head[key];
    print
    print text
    for item in line:
        print item;
        

message('this is text','first line','second line',subject='lunch',to='jack@163.com',sender='one@163.com')


output:

to:jack@163.com
sender:one @163.com
subject:lunch


this is text
first line
second line

原创粉丝点击