{"id":6742,"date":"2024-05-08T13:21:41","date_gmt":"2024-05-08T04:21:41","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=6742"},"modified":"2024-05-09T07:44:58","modified_gmt":"2024-05-08T22:44:58","slug":"python-%e5%86%85%e5%8c%85%e8%a1%a8%e8%a8%98","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/6742","title":{"rendered":"[Python] \u5185\u5305\u8868\u8a18"},"content":{"rendered":"<p>\u30ea\u30b9\u30c8\u3092\u751f\u6210\u3059\u308b\u7c21\u6f54\u306a\u624b\u6bb5<\/p>\n<h3>1\u304b\u30895\u307e\u3067\u306e\u5e73\u65b9\u6839\u306e\u30ea\u30b9\u30c8\u3092\u751f\u6210\u3059\u308b\u5185\u5305\u8868\u8a18\u306e\u4f8b<\/h3>\n<pre class=\"lang:python decode:true \" >squares = [x*x for x in [1, 2, 3, 4, 5]]<\/pre>\n<p>\u30ea\u30b9\u30c8 <code>[1, 2, 3, 4, 5]<\/code> \u304b\u3089 <code>[1, 4, 9, 16, 25]<\/code> \u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<h3>1\u304b\u30895\u307e\u3067\u306e\u5e73\u65b9\u6839\u306e\u30ea\u30b9\u30c8\u3092\u751f\u6210\u3059\u308bfor\u69cb\u6587\u306e\u4f8b<\/h3>\n<pre class=\"lang:python decode:true \" >squares = []\r\nfor x in [1, 2, 3, 4, 5]:\r\n    squares.append(x*x)<\/pre>\n<h3>\u5916\u90e8\u30ea\u30f3\u30af<\/h3>\n<ul>\n<li><a href=\"https:\/\/docs.python.org\/ja\/3\/tutorial\/datastructures.html#list-comprehensions\">Official Documents: \u30ea\u30b9\u30c8\u306e\u5185\u5305\u8868\u8a18<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u30ea\u30b9\u30c8\u3092\u751f\u6210\u3059\u308b\u7c21\u6f54\u306a\u624b\u6bb5 1\u304b\u30895\u307e\u3067\u306e\u5e73\u65b9\u6839\u306e\u30ea\u30b9\u30c8\u3092\u751f\u6210\u3059\u308b\u5185\u5305\u8868\u8a18\u306e\u4f8b squares = [x*x for x in [1, 2, 3, 4, 5]] \u30ea\u30b9\u30c8 [1, 2, 3, 4, 5] \u304b\u3089 [1, 4, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[52],"class_list":["post-6742","post","type-post","status-publish","format-standard","hentry","category-memo","tag-python"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/6742","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=6742"}],"version-history":[{"count":9,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/6742\/revisions"}],"predecessor-version":[{"id":6751,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/6742\/revisions\/6751"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=6742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=6742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=6742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}