{"id":3501,"date":"2025-02-28T22:35:31","date_gmt":"2025-02-28T13:35:31","guid":{"rendered":"https:\/\/wtpmj.com\/?p=3501"},"modified":"2025-02-28T22:35:31","modified_gmt":"2025-02-28T13:35:31","slug":"python%e3%81%ae%e3%83%87%e3%83%bc%e3%82%bf%e6%a7%8b%e9%80%a0%e3%82%92%e7%90%86%e8%a7%a3%e3%81%99%e3%82%8b-%e3%83%aa%e3%82%b9%e3%83%88%e3%80%81%e3%82%bf%e3%83%97%e3%83%ab%e3%80%81%e9%9b%86%e5%90%88","status":"publish","type":"post","link":"https:\/\/wtpmj.com\/?p=3501","title":{"rendered":"Python\u306e\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u7406\u89e3\u3059\u308b: \u30ea\u30b9\u30c8\u3001\u30bf\u30d7\u30eb\u3001\u96c6\u5408\u3001\u8f9e\u66f8\u306e\u4f7f\u3044\u5206\u3051"},"content":{"rendered":"<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/downloaded_image_1740749723.jpg\"><\/p>\n<h1>Python\u306e\u30c6\u3099\u30fc\u30bf\u69cb\u9020:\u30ea\u30b9\u30c8\u3001\u30bf\u30d5\u309a\u30eb\u3001\u96c6\u5408\u3001\u8f9e\u66f8\u306e\u4f7f\u3044\u5206\u3051<\/h1>\n<p>\u305d\u308c\u305d\u3099\u308c\u306e\u30c6\u3099\u30fc\u30bf\u69cb\u9020\u306b\u306f\u7279\u5fb4\u304b\u3099\u3042\u308a\u3001\u7528\u9014\u306b\u3088\u3063\u3066\u6700\u9069\u306a\u9078\u629e\u304b\u3099\u5909\u308f\u308a\u307e\u3059\u3002\u5b9f\u969b\u306e\u4f7f\u7528\u4f8b\u3068\u5171\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30ea\u30b9\u30c8 (List)<\/h2>\n<p><strong>\u7279\u5fb4<\/strong>: \u9806\u5e8f\u4ed8\u304d\u3001\u5909\u66f4\u53ef\u80fd\u3001\u91cd\u8907\u53ef\u80fd<\/p>\n<p><strong>\u4f7f\u3046\u3078\u3099\u304d\u4f8b<\/strong>:<\/p>\n<pre><code class=\"language-python\"># \u5b66\u751f\u306e\u540d\u524d\u30ea\u30b9\u30c8(\u9806\u5e8f\u304b\u3099\u91cd\u8981\u3001\u5f8c\u304b\u3089\u5909\u66f4\u306e\u53ef\u80fd\u6027\u3042\u308a)\nstudents = ['\u592a\u90ce', '\u82b1\u5b50', '\u6b21\u90ce']\nstudents.append('\u826f\u5b50')  # \u8981\u7d20\u306e\u8ffd\u52a0\nstudents[0] = '\u5927\u592a\u90ce'   # \u8981\u7d20\u306e\u5909\u66f4<\/code><\/pre>\n<p><strong>\u9069\u3057\u3066\u3044\u308b\u72b6\u6cc1<\/strong>:<\/p>\n<ul>\n<li>\u30c6\u3099\u30fc\u30bf\u306e\u9806\u5e8f\u304b\u3099\u91cd\u8981\u306a\u5834\u5408<\/li>\n<li>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u5185\u5bb9\u3092\u5f8c\u304b\u3089\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304b\u3099\u3042\u308b\u5834\u5408<\/li>\n<li>\u540c\u3057\u3099\u8981\u7d20\u3092\u8907\u6570\u56de\u542b\u3081\u308b\u5fc5\u8981\u304b\u3099\u3042\u308b\u5834\u5408<\/li>\n<\/ul>\n<h2>\u30bf\u30d5\u309a\u30eb (Tuple)<\/h2>\n<p><strong>\u7279\u5fb4<\/strong>: \u9806\u5e8f\u4ed8\u304d\u3001\u5909\u66f4\u4e0d\u53ef\u3001\u91cd\u8907\u53ef\u80fd<\/p>\n<p><strong>\u4f7f\u3046\u3078\u3099\u304d\u4f8b<\/strong>:<\/p>\n<pre><code class=\"language-python\"># \u5ea7\u6a19(x, y)- \u4e00\u5ea6\u5b9a\u7fa9\u3057\u305f\u3089\u5909\u66f4\u3057\u306a\u3044\u5024\u306e\u30d8\u309a\u30a2\npoint = (10, 20)\n\n# \u500b\u4eba\u60c5\u5831(\u5909\u66f4\u3055\u308c\u308b\u3078\u3099\u304d\u3066\u3099\u306a\u3044\u30c6\u3099\u30fc\u30bf)\nperson = ('\u5c71\u7530', '\u592a\u90ce', 30)<\/code><\/pre>\n<p><strong>\u9069\u3057\u3066\u3044\u308b\u72b6\u6cc1<\/strong>:<\/p>\n<ul>\n<li>\u30c6\u3099\u30fc\u30bf\u304b\u3099\u5909\u66f4\u3055\u308c\u308b\u3078\u3099\u304d\u3066\u3099\u306a\u3044\u5834\u5408<\/li>\n<li>\u8f9e\u66f8\u306e\u30ad\u30fc\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u5834\u5408(\u30ea\u30b9\u30c8\u306f\u30ad\u30fc\u306b\u4f7f\u3048\u306a\u3044)<\/li>\n<li>\u95a2\u6570\u304b\u3089\u8907\u6570\u306e\u5024\u3092\u8fd4\u3059\u5834\u5408<\/li>\n<li>\u30c6\u3099\u30fc\u30bf\u4fdd\u8b77\u304b\u3099\u5fc5\u8981\u306a\u5834\u5408<\/li>\n<\/ul>\n<h2>\u96c6\u5408 (Set)<\/h2>\n<p><strong>\u7279\u5fb4<\/strong>: \u9806\u5e8f\u306a\u3057\u3001\u5909\u66f4\u53ef\u80fd\u3001\u91cd\u8907\u4e0d\u53ef<\/p>\n<p><strong>\u4f7f\u3046\u3078\u3099\u304d\u4f8b<\/strong>:<\/p>\n<pre><code class=\"language-python\"># \u8a2a\u554f\u6e08\u307f\u306e\u30e6\u30fc\u30b5\u3099\u30fcID(\u91cd\u8907\u306f\u610f\u5473\u304b\u3099\u306a\u3044)\nvisited_users = {1001, 1002, 1003, 1004}\nvisited_users.add(1005)  # \u8981\u7d20\u306e\u8ffd\u52a0\n\n# 2\u3064\u306e\u30af\u3099\u30eb\u30fc\u30d5\u309a\u306e\u5171\u901a\u30e1\u30f3\u30cf\u3099\u30fc\u3092\u898b\u3064\u3051\u308b\ngroup_a = {'\u592a\u90ce', '\u82b1\u5b50', '\u6b21\u90ce'}\ngroup_b = {'\u82b1\u5b50', '\u826f\u5b50', '\u5065\u592a'}\ncommon_members = group_a & group_b  # {'\u82b1\u5b50'}<\/code><\/pre>\n<p><strong>\u9069\u3057\u3066\u3044\u308b\u72b6\u6cc1<\/strong>:<\/p>\n<ul>\n<li>\u91cd\u8907\u3092\u81ea\u52d5\u7684\u306b\u6392\u9664\u3057\u305f\u3044\u5834\u5408<\/li>\n<li>\u96c6\u5408\u6f14\u7b97(\u548c\u96c6\u5408\u3001\u7a4d\u96c6\u5408\u3001\u5dee\u96c6\u5408)\u3092\u884c\u3044\u305f\u3044\u5834\u5408<\/li>\n<li>\u8981\u7d20\u306e\u5b58\u5728\u78ba\u8a8d\u3092\u9ad8\u901f\u306b\u884c\u3044\u305f\u3044\u5834\u5408<\/li>\n<\/ul>\n<h2>\u8f9e\u66f8 (Dictionary)<\/h2>\n<p><strong>\u7279\u5fb4<\/strong>: \u30ad\u30fc\u3068\u5024\u306e\u30d8\u309a\u30a2\u3001\u9806\u5e8f\u4ed8\u304d(Python 3.7\u4ee5\u964d)\u3001\u30ad\u30fc\u306f\u4e00\u610f<\/p>\n<p><strong>\u4f7f\u3046\u3078\u3099\u304d\u4f8b<\/strong>:<\/p>\n<pre><code class=\"language-python\"># \u5b66\u751f\u306e\u6210\u7e3e\u7ba1\u7406(\u540d\u524d\u3068\u70b9\u6570\u306e\u5bfe\u5fdc)\nscores = {\n    '\u592a\u90ce': 85,\n    '\u82b1\u5b50': 92,\n    '\u6b21\u90ce': 78\n}\nscores['\u826f\u5b50'] = 90  # \u65b0\u3057\u3044\u751f\u5f92\u306e\u8ffd\u52a0\n\n# \u5546\u54c1\u7ba1\u7406\nproduct = {\n    'id': 'A001',\n    'name': '\u30ce\u30fc\u30c8\u30cf\u309a\u30bd\u30b3\u30f3',\n    'price': 98000,\n    'in_stock': True\n}<\/code><\/pre>\n<p><strong>\u9069\u3057\u3066\u3044\u308b\u72b6\u6cc1<\/strong>:<\/p>\n<ul>\n<li>\u30ad\u30fc\u3068\u5024\u306e\u30de\u30c3\u30d2\u309a\u30f3\u30af\u3099\u304b\u3099\u5fc5\u8981\u306a\u5834\u5408<\/li>\n<li>\u9ad8\u901f\u306a\u30eb\u30c3\u30af\u30a2\u30c3\u30d5\u309a(\u691c\u7d22)\u304b\u3099\u5fc5\u8981\u306a\u5834\u5408<\/li>\n<li>\u8907\u96d1\u306a\u30c6\u3099\u30fc\u30bf\u69cb\u9020\u3092\u8868\u73fe\u3059\u308b\u5834\u5408<\/li>\n<li>JSON\u3068\u306e\u76f8\u4e92\u5909\u63db\u304b\u3099\u5fc5\u8981\u306a\u5834\u5408<\/li>\n<\/ul>\n<h2>\u5b9f\u8df5\u7684\u306a\u4f7f\u3044\u5206\u3051\u4f8b<\/h2>\n<pre><code class=\"language-python\"># \u30ea\u30b9\u30c8:\u9806\u5e8f\u4ed8\u304d\u30c6\u3099\u30fc\u30bf\nshopping_list = ['\u5375', '\u725b\u4e73', '\u30cf\u309a\u30f3', '\u308a\u3093\u3053\u3099']\n\n# \u30bf\u30d5\u309a\u30eb:\u4e0d\u5909\u30c6\u3099\u30fc\u30bf\nrgb_color = (255, 128, 0)\nweekdays = ('\u6708', '\u706b', '\u6c34', '\u6728', '\u91d1', '\u571f', '\u65e5')\n\n# \u96c6\u5408:\u4e00\u610f\u306a\u5024\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\nunique_visitors = {192, 195, 198, 203, 192}  # \u81ea\u52d5\u7684\u306b\u91cd\u8907\u6392\u9664\n\n# \u8f9e\u66f8:\u30ad\u30fc\u3068\u5024\u306e\u30de\u30c3\u30d2\u309a\u30f3\u30af\u3099\nuser = {\n    'username': 'tanaka',\n    'email': 'tanaka@example.com',\n    'active': True,\n    'login_count': 42\n}<\/code><\/pre>\n<p>\u4ee5\u4e0a\u306e\u7279\u5fb4\u3092\u8e0f\u307e\u3048\u3066\u3001\u72b6\u6cc1\u306b\u5fdc\u3057\u3099\u3066\u6700\u9069\u306a\u30c6\u3099\u30fc\u30bf\u69cb\u9020\u3092\u9078\u3075\u3099\u3053\u3068\u304b\u3099\u91cd\u8981\u3066\u3099\u3059\u3002\u30c6\u3099\u30fc\u30bf\u306e\u6027\u8cea\u3084\u64cd\u4f5c\u306e\u7a2e\u985e\u306b\u3088\u3063\u3066\u3001\u6700\u3082\u52b9\u7387\u7684\u306a\u9078\u629e\u304b\u3099\u5909\u308f\u3063\u3066\u304d\u307e\u3059\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u306e\u30c6\u3099\u30fc\u30bf\u69cb\u9020:\u30ea\u30b9\u30c8\u3001\u30bf\u30d5\u309a\u30eb\u3001\u96c6\u5408\u3001\u8f9e\u66f8\u306e\u4f7f\u3044\u5206\u3051 \u305d\u308c\u305d\u3099\u308c\u306e\u30c6\u3099\u30fc\u30bf\u69cb\u9020\u306b\u306f\u7279\u5fb4\u304b\u3099\u3042\u308a\u3001\u7528\u9014\u306b\u3088\u3063\u3066\u6700\u9069\u306a\u9078\u629e\u304b\u3099\u5909\u308f\u308a\u307e\u3059\u3002\u5b9f\u969b\u306e\u4f7f\u7528\u4f8b\u3068\u5171\u306b\u8aac\u660e\u3057\u307e\u3059\u3002 \u30ea\u30b9\u30c8 (List) \u7279\u5fb4: \u9806\u5e8f\u4ed8\u304d\u3001 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[557],"tags":[655,979,976,974,980,677,975,978,977],"class_list":["post-3501","post","type-post","status-publish","format-standard","hentry","category-557","tag-python","tag-979","tag-976","tag-974","tag-980","tag-677","tag-975","tag-978","tag-977"],"_links":{"self":[{"href":"https:\/\/wtpmj.com\/index.php?rest_route=\/wp\/v2\/posts\/3501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wtpmj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wtpmj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wtpmj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wtpmj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3501"}],"version-history":[{"count":0,"href":"https:\/\/wtpmj.com\/index.php?rest_route=\/wp\/v2\/posts\/3501\/revisions"}],"wp:attachment":[{"href":"https:\/\/wtpmj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wtpmj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wtpmj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}