{"id":481,"date":"2021-04-25T16:35:38","date_gmt":"2021-04-25T07:35:38","guid":{"rendered":"http:\/\/www.agile-software.site\/?p=481"},"modified":"2021-04-25T16:35:39","modified_gmt":"2021-04-25T07:35:39","slug":"args-%e3%80%81-kwargsn%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e7%90%86%e8%a7%a3%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/agile-software.net\/?p=481","title":{"rendered":"*args \u3001 **kwargsn\u306b\u3064\u3044\u3066\u7406\u89e3\u3059\u308b"},"content":{"rendered":"\n<p><code>*args<\/code>&nbsp;\u3001&nbsp;<code>**kwargs<\/code>&nbsp;\u306f\u3001\u95a2\u6570\u304c\u5f15\u6570\u3092\u3046\u3051\u3068\u308b\u65b9\u6cd5\u306e1\u3064\u3060\u3068\u8003\u3048\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u95a2\u6570\u5b9a\u7fa9\u3067\u5f15\u6570\u306b<code>*<\/code>\u3068<code>**<\/code>\uff081\u500b\u307e\u305f\u306f2\u500b\u306e\u30a2\u30b9\u30bf\u30ea\u30b9\u30af\uff09\u3092\u3064\u3051\u308b\u3068\u3001\u4efb\u610f\u306e\u6570\u306e\u5f15\u6570\uff08\u53ef\u5909\u9577\u5f15\u6570\uff09\u3092\u6307\u5b9a\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<p>Python\u3067\u306f\u3001\u8907\u6570\u306e\u30c7\u30fc\u30bf\u306e\u7d44\u307f\u5408\u308f\u305b\u304b\u3089\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3092\u8868\u73fe\u3059\u308b\u5834\u5408\u3001<strong>\u30bf\u30d7\u30eb<\/strong>&nbsp;\u3068\u3044\u3046\u7a2e\u985e\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5229\u7528\u3057\u307e\u3059\u3002\u30bf\u30d7\u30eb\u306f\u5909\u66f4\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>*args<\/code>: \u8907\u6570\u306e\u5f15\u6570\u3092\u30bf\u30d7\u30eb\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b<\/li><li><code>**kwargs<\/code>: \u8907\u6570\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u5f15\u6570\u3092\u8f9e\u66f8\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b<\/li><\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">\u4f8b<\/h5>\n\n\n\n<p>hello\u95a2\u6570\u5185\u306eargs\u5f15\u6570\u306b\u3001\u547c\u3073\u51fa\u3057\u6642\u306b\u6e21\u3055\u308c\u305f2\u3064\u306e\u5f15\u6570(&#8220;hiroki&#8221;, &#8220;saito&#8221;)\u304c\u30bf\u30d7\u30eb\u306b\u5165\u3063\u3066print\u6587\u3067args\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306b&nbsp;<code>*args<\/code>&nbsp;\u306f\u5358\u7d14\u306b\u5f15\u6570\u3092\u53d7\u3051\u53d6\u308b\u65b9\u6cd5\u306e1\u3064\u306b\u904e\u304e\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\" data-file=\"\u4f8b\"><code>def hello(*args):\n    print(args)\n    \nhello(&quot;hiroki&quot;, &quot;saito&quot;)  # (&#39;hiroki&#39;, &#39;saito&#39;) \u3068\u8868\u793a\u3055\u308c\u307e\u3059<\/code><\/pre><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">\u4f8b<\/h5>\n\n\n\n<p>hello\u95a2\u6570\u306b\u306f&nbsp;<code>name=\"hiroki\", hometown=\"osaka\"<\/code>&nbsp;\u3068\u3044\u3046\u5024\u3092\u6e21\u3057\u3066print\u6587\u3067kwargs\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>def hello(**kwargs):\n    print(kwargs)\n\nhello(name=&quot;hiroki&quot;, hometown=&quot;osaka&quot;)  # {&#39;name&#39;: &#39;hiroki&#39;, &#39;hometown&#39;: &#39;osaka&#39;} \u3068\u8868\u793a\u3055\u308c\u307e\u3059<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>*args\u3001**kwargs\u306f\u3001\u95a2\u6570\u304c\u5f15\u6570\u3092\u3046\u3051\u3068\u308b\u65b9\u6cd5\u306e1\u3064\u3060\u3068\u8003\u3048\u307e\u3057\u3087\u3046\u3002 \u95a2\u6570\u5b9a\u7fa9\u3067\u5f15\u6570\u306b*\u3068**\uff081\u500b\u307e\u305f\u306f2\u500b\u306e\u30a2\u30b9\u30bf\u30ea\u30b9\u30af\uff09\u3092\u3064\u3051\u308b\u3068\u3001\u4efb\u610f\u306e\u6570\u306e\u5f15\u6570\uff08\u53ef\u5909\u9577\u5f15\u6570\uff09\u3092\u6307\u5b9a<\/p>\n","protected":false},"author":1,"featured_media":482,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-481","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=481"}],"version-history":[{"count":1,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/481\/revisions"}],"predecessor-version":[{"id":483,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/481\/revisions\/483"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/media\/482"}],"wp:attachment":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}