Unpacking Argument Lists

Unpacking Argument Lists

1 Python[ | ]

def showUrl(host, path, **params):
    url = 'http://' + host + path
    delim = '?'
    for k, v in params.items():
        url += delim + k + '=' + v
        delim = '&'
    print( url )

showUrl('jmnote.com', '/w/api.php', action='query', prop='info', titles='return')
# http://jmnote.com/w/api.php?prop=info&titles=return&action=query

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}