{"id":336,"date":"2018-12-31T15:28:10","date_gmt":"2018-12-31T06:28:10","guid":{"rendered":"https:\/\/www.nblog09.com\/w\/?p=336"},"modified":"2025-09-28T11:45:42","modified_gmt":"2025-09-28T02:45:42","slug":"python-list","status":"publish","type":"post","link":"https:\/\/www.nblog09.com\/w\/2018\/12\/31\/python-list\/","title":{"rendered":"Python\u306e\u914d\u5217\uff08\u30ea\u30b9\u30c8\uff09\u306e\u4f7f\u3044\u65b9\u3001\u30e1\u30bd\u30c3\u30c9\uff08append, extend, insert, remove, pop, sort, count, index\u7b49\uff09\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u307e\u3057\u305f"},"content":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Python\u306e<strong>\u30ea\u30b9\u30c8\u578b\uff08list\uff09<\/strong>\u306b\u3064\u3044\u3066\u3001\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u5b9f\u8df5\u7684\u306a\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3059\u308b\u3002<\/p>\n<h2 class=\"title-border\">\u30ea\u30b9\u30c8\u578b\u3068\u306f\u4f55\u304b<\/h2>\n<p>\u30ea\u30b9\u30c8\u578b\u306f\u3001<strong>\u69d8\u3005\u306a\u30c7\u30fc\u30bf\u578b\u306e\u8981\u7d20\u3092\u683c\u7d0d\u3067\u304d\u3001\u9806\u5e8f\u4ed8\u3051\u3089\u308c\u3001\u5909\u66f4\u53ef\u80fd\uff08mutable\uff09\u306a\u30c7\u30fc\u30bf\u578b<\/strong>\u3060\u3002\u7570\u306a\u308b\u7a2e\u985e\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u9806\u756a\u306b\u4e26\u3079\u3066\u4fdd\u7ba1\u3067\u304d\u308b\u4fbf\u5229\u306a\u4ed5\u7d44\u307f\u3067\u3042\u308b\u3002<\/p>\n<div class=\"sub-item\">\n<h3>\u30ea\u30b9\u30c8\u306e\u57fa\u672c\u7684\u306a\u4f5c\u6210\u65b9\u6cd5<\/h3>\n<p>\u30ea\u30b9\u30c8\u306f\u89d2\u62ec\u5f27[]\u3067\u56f2\u3093\u3067\u5ba3\u8a00\u3057\u3001\u8981\u7d20\u306f\u30ab\u30f3\u30de\u3067\u533a\u5207\u3063\u3066\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\"># \u7a7a\u306e\u30ea\u30b9\u30c8\nempty_list = []\n\n# \u6574\u6570\u306e\u30ea\u30b9\u30c8\nnumbers = [1, 2, 3, 4, 5]\n\n# \u69d8\u3005\u306a\u578b\u3092\u542b\u3080\u30ea\u30b9\u30c8\nmixed = [1, \"Hello\", 3.14, True]\n\n# \u30cd\u30b9\u30c8\u3055\u308c\u305f\u30ea\u30b9\u30c8\uff08\u30ea\u30b9\u30c8\u306e\u4e2d\u306b\u30ea\u30b9\u30c8\uff09\nnested = [1, [2, 3], [4, 5, 6]]\n\nprint(f\"\u6574\u6570\u30ea\u30b9\u30c8: {numbers}\")\nprint(f\"\u6df7\u5408\u30ea\u30b9\u30c8: {mixed}\")\n<\/code><\/pre>\n<\/div>\n<div class=\"sub-item\">\n<h3>\u30ea\u30b9\u30c8\u306e\u30e1\u30e2\u30ea\u69cb\u9020<\/h3>\n<p>\u30ea\u30b9\u30c8\u306f\u5185\u90e8\u7684\u306b\u3001\u5404\u8981\u7d20\u3078\u306e\u53c2\u7167\uff08\u30dd\u30a4\u30f3\u30bf\uff09\u3092\u4fdd\u6301\u3057\u3066\u3044\u308b\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u7570\u306a\u308b\u578b\u306e\u8981\u7d20\u3092\u52b9\u7387\u7684\u306b\u7ba1\u7406\u3067\u304d\u308b\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">my_list = [5, 6, \"Hello\"]\n\n# \u30ea\u30b9\u30c8\u306e\u9577\u3055\u3092\u53d6\u5f97\nprint(f\"\u30ea\u30b9\u30c8\u306e\u9577\u3055: {len(my_list)}\")  # 3\n\n# \u30ea\u30b9\u30c8\u306e\u578b\u3092\u78ba\u8a8d\nprint(f\"\u30c7\u30fc\u30bf\u578b: {type(my_list)}\")  # &lt;class 'list'&gt;\n<\/code><\/pre>\n<\/div>\n<h2 class=\"title-border\">\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3088\u308b\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/h2>\n<p>\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u306b\u306f\u30010\u304b\u3089\u59cb\u307e\u308b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u3092\u4f7f\u3063\u3066\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3002\u8ca0\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u3048\u3070\u3001\u672b\u5c3e\u304b\u3089\u6570\u3048\u308b\u3053\u3068\u3082\u53ef\u80fd\u3060\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">fruits = [\"\u308a\u3093\u3054\", \"\u30d0\u30ca\u30ca\", \"\u30aa\u30ec\u30f3\u30b8\", \"\u3076\u3069\u3046\", \"\u30e1\u30ed\u30f3\"]\n\n# \u6b63\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\uff08\u5148\u982d\u304b\u3089\uff09\nfirst = fruits[0]    # \"\u308a\u3093\u3054\"\nthird = fruits[2]    # \"\u30aa\u30ec\u30f3\u30b8\"\n\n# \u8ca0\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\uff08\u672b\u5c3e\u304b\u3089\uff09\nlast = fruits[-1]    # \"\u30e1\u30ed\u30f3\"\nsecond_last = fruits[-2]  # \"\u3076\u3069\u3046\"\n\nprint(f\"\u6700\u521d\u306e\u679c\u7269: {first}\")\nprint(f\"\u6700\u5f8c\u306e\u679c\u7269: {last}\")\n\n# \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u7bc4\u56f2\u5916\u30a2\u30af\u30bb\u30b9\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308b\n# print(fruits[10])  # IndexError: list index out of range\n<\/code><\/pre>\n<div class=\"tips\"><strong>\u8ca0\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9<\/strong>\u306f\u975e\u5e38\u306b\u4fbf\u5229\u306a\u6a5f\u80fd\u3060\u3002\u7279\u306b\u300c\u6700\u5f8c\u306e\u8981\u7d20\u3060\u3051\u304c\u6b32\u3057\u3044\u300d\u3068\u3044\u3046\u5834\u9762\u3067\u306f\u3001\u30ea\u30b9\u30c8\u306e\u9577\u3055\u3092\u8abf\u3079\u308b\u5fc5\u8981\u304c\u306a\u304f\u3001\u5358\u7d14\u306b[-1]\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3002<\/div>\n<a href=\"https:\/\/www.udemy.com\/course\/python-python\/?couponCode=20260500_NM_PYTHON\" target=\"_blank\"><div class=\"affiliate-box\"><img decoding=\"async\" src=\"\/wp-content\/uploads\/2025\/09\/Python3.11.png\" alt=\"Python\u8b1b\u5ea7\" class=\"affiliate-img\"><div class=\"affiliate-text\"><h3 class=\"affiliate-title\">\u3010Udemy\u3011Python\u5165\u9580\u8b1b\u5ea7(0\u304b\u3089Python\u306e\u57fa\u790e\u3092\u4f53\u7cfb\u7684\u306b\u5b66\u3093\u3067\u3001\u751f\u6210AI\u3067\u30d0\u30a4\u30d6\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0)<\/h3><p class=\"affiliate-desc\">\u53d7\u8b1b\u751f3000\u4eba\u307b\u3069\u306e\u4eba\u6c17\u8b1b\u5ea7\u3002<strong>Python\u306e\u57fa\u790e\u304b\u3089\u751f\u6210AI\u6d3b\u7528<\/strong>\u307e\u3067\u3092<strong>20\u6642\u9593\u307b\u3069<\/strong>\u3067\u4e00\u6c17\u306b\u5b66\u3073\u307e\u3059\u3002\u696d\u52d9\u3067\u6d3b\u304b\u305b\u308bPython\u306e\u57fa\u790e\u77e5\u8b58\u306f\u3057\u3063\u304b\u308a\u3068\u8eab\u306b\u3064\u304d\u307e\u3059\u3002<\/p><\/div><\/div><\/a>\n<h2 class=\"title-border\">\u30ea\u30b9\u30c8\u3078\u306e\u8981\u7d20\u306e\u8ffd\u52a0<\/h2>\n<p>\u30ea\u30b9\u30c8\u306f\u4f5c\u6210\u5f8c\u3082\u8981\u7d20\u3092\u81ea\u7531\u306b\u8ffd\u52a0\u3067\u304d\u308b\u3002\u7528\u9014\u306b\u5fdc\u3058\u3066\u8907\u6570\u306e\u65b9\u6cd5\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<div class=\"sub-item\">\n<h3>\u5358\u4e00\u8981\u7d20\u306e\u8ffd\u52a0<\/h3>\n<p><b>append()\u30e1\u30bd\u30c3\u30c9<\/b>: \u30ea\u30b9\u30c8\u306e\u672b\u5c3e\u306b\u5358\u4e00\u8981\u7d20\u3092\u8ffd\u52a0\u3059\u308b <b>insert()\u30e1\u30bd\u30c3\u30c9<\/b>: \u6307\u5b9a\u3057\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f4d\u7f6e\u306b\u8981\u7d20\u3092\u633f\u5165\u3059\u308b<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">my_list = [1, 2, 3]\n\n# \u672b\u5c3e\u3078\u306e\u8981\u7d20\u306e\u8ffd\u52a0\nmy_list.append(4)\nprint(my_list)  # [1, 2, 3, 4]\n\n# \u7279\u5b9a\u306e\u4f4d\u7f6e\u3078\u306e\u8981\u7d20\u306e\u633f\u5165\nmy_list.insert(1, \"\u65b0\u8981\u7d20\")\nprint(my_list)  # [1, \"\u65b0\u8981\u7d20\", 2, 3, 4]\n<\/code><\/pre>\n<\/div>\n<div class=\"sub-item\">\n<h3>\u8907\u6570\u8981\u7d20\u306e\u8ffd\u52a0<\/h3>\n<p><b>extend()\u30e1\u30bd\u30c3\u30c9<\/b>: \u5225\u306e\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u3092\u73fe\u5728\u306e\u30ea\u30b9\u30c8\u306b\u8ffd\u52a0\u3059\u308b <b>+\u6f14\u7b97\u5b50<\/b>: 2\u3064\u306e\u30ea\u30b9\u30c8\u3092\u7d50\u5408\u3057\u3066\u65b0\u3057\u3044\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">my_list = [1, 2, 3]\n\n# \u30ea\u30b9\u30c8\u306e\u62e1\u5f35\uff08\u5225\u306e\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u3092\u8ffd\u52a0\uff09\nmy_list.extend([4, 5, 6])\nprint(my_list)  # [1, 2, 3, 4, 5, 6]\n\n# + \u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u305f\u7d50\u5408\uff08\u65b0\u3057\u3044\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\uff09\nnew_list = my_list + [7, 8, 9]\nprint(new_list)  # [1, 2, 3, 4, 5, 6, 7, 8, 9]\n<\/code><\/pre>\n<\/div>\n<h2 class=\"title-border\">\u30ea\u30b9\u30c8\u304b\u3089\u306e\u8981\u7d20\u306e\u524a\u9664<\/h2>\n<p>\u8981\u7d20\u306e\u524a\u9664\u306b\u3082\u8907\u6570\u306e\u65b9\u6cd5\u304c\u3042\u308a\u3001\u305d\u308c\u305e\u308c\u7570\u306a\u308b\u7279\u5fb4\u3092\u6301\u3063\u3066\u3044\u308b\u3002 <b>remove()\u30e1\u30bd\u30c3\u30c9<\/b>: \u6307\u5b9a\u3057\u305f\u5024\u3068\u4e00\u81f4\u3059\u308b\u6700\u521d\u306e\u8981\u7d20\u3092\u524a\u9664\u3059\u308b <b>pop()\u30e1\u30bd\u30c3\u30c9<\/b>: \u6307\u5b9a\u3057\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u8981\u7d20\u3092\u524a\u9664\u3057\u3001\u305d\u306e\u5024\u3092\u8fd4\u3059 <b>clear()\u30e1\u30bd\u30c3\u30c9<\/b>: \u30ea\u30b9\u30c8\u5185\u306e\u3059\u3079\u3066\u306e\u8981\u7d20\u3092\u524a\u9664\u3059\u308b<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">my_list = [1, 2, 3, 4, 3, 5]\n\n# \u5024\u3092\u6307\u5b9a\u3057\u3066\u524a\u9664\uff08\u6700\u521d\u306b\u898b\u3064\u304b\u3063\u305f\u3082\u306e\uff09\nmy_list.remove(3)\nprint(my_list)  # [1, 2, 4, 3, 5]\n\n# \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u6307\u5b9a\u3057\u3066\u524a\u9664\u3057\u3001\u524a\u9664\u3057\u305f\u8981\u7d20\u3092\u53d6\u5f97\nmy_list = [1, 2, 3, 4, 5]\nelement = my_list.pop(2)  # \u30a4\u30f3\u30c7\u30c3\u30af\u30b92\u306e\u8981\u7d20\u3092\u524a\u9664\nprint(f\"\u524a\u9664\u3057\u305f\u8981\u7d20: {element}\")  # 3\nprint(my_list)  # [1, 2, 4, 5]\n\n# \u672b\u5c3e\u306e\u8981\u7d20\u3092\u524a\u9664\uff08\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7701\u7565\uff09\nlast_element = my_list.pop()\nprint(f\"\u6700\u5f8c\u306e\u8981\u7d20: {last_element}\")  # 5\nprint(my_list)  # [1, 2, 4]\n\n# \u30ea\u30b9\u30c8\u3092\u30af\u30ea\u30a2\uff08\u5168\u8981\u7d20\u524a\u9664\uff09\nmy_list.clear()\nprint(my_list)  # []\n<\/code><\/pre>\n<h2 class=\"title-border\">\u30ea\u30b9\u30c8\u306e\u30b9\u30e9\u30a4\u30b7\u30f3\u30b0<\/h2>\n<p>\u30b9\u30e9\u30a4\u30b7\u30f3\u30b0\u306f\u3001\u30ea\u30b9\u30c8\u304b\u3089\u90e8\u5206\u30ea\u30b9\u30c8\u3092\u62bd\u51fa\u3059\u308b\u5f37\u529b\u306a\u6a5f\u80fd\u3060\u3002\u57fa\u672c\u69cb\u6587\u306f<strong>list[start:stop:step]<\/strong>\u3068\u306a\u308b\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">my_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n# \u57fa\u672c\u7684\u306a\u5207\u308a\u51fa\u3057\nslice1 = my_list[2:7]     # [2, 3, 4, 5, 6]\nslice2 = my_list[1:8:2]   # [1, 3, 5, 7] (2\u6587\u5b57\u304a\u304d)\nslice3 = my_list[:3]      # [0, 1, 2] (\u958b\u59cb\u4f4d\u7f6e\u7701\u7565)\nslice4 = my_list[3:]      # [3, 4, 5, 6, 7, 8, 9] (\u7d42\u4e86\u4f4d\u7f6e\u7701\u7565)\n\n# \u9006\u9806\u53d6\u5f97\nreverse = my_list[::-1]   # [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n\nprint(f\"\u90e8\u5206\u30ea\u30b9\u30c8: {slice1}\")\nprint(f\"2\u6587\u5b57\u304a\u304d: {slice2}\")\nprint(f\"\u9006\u9806: {reverse}\")\n<\/code><\/pre>\n<div class=\"tips\">\u30b9\u30e9\u30a4\u30b7\u30f3\u30b0\u3092\u7528\u3044\u308c\u3070\u3001<strong>\u4e00\u5ea6\u306e\u64cd\u4f5c\u3067\u8907\u96d1\u306a\u90e8\u5206\u62bd\u51fa\u3084\u9006\u9806\u5909\u63db\u304c\u3067\u304d\u308b<\/strong>\u305f\u3081\u3001\u30c7\u30fc\u30bf\u51e6\u7406\u306e\u52b9\u7387\u304c\u683c\u6bb5\u306b\u5411\u4e0a\u3059\u308b\u3002\u7279\u306b<strong>[::-1]<\/strong>\u306b\u3088\u308b\u9006\u9806\u53d6\u5f97\u306f\u3001\u591a\u304f\u306e\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u304c\u611b\u7528\u3059\u308b\u65b9\u6cd5\u3060\u3002<\/div>\n<h2 class=\"title-border\">\u30ea\u30b9\u30c8\u306e\u691c\u7d22\u3068\u60c5\u5831\u53d6\u5f97<\/h2>\n<p>\u30ea\u30b9\u30c8\u5185\u306e\u8981\u7d20\u3092\u691c\u7d22\u3057\u305f\u308a\u3001\u30ea\u30b9\u30c8\u306e\u72b6\u614b\u3092\u8abf\u3079\u308b\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3002 <b>count()\u30e1\u30bd\u30c3\u30c9<\/b>: \u6307\u5b9a\u3057\u305f\u5024\u304c\u30ea\u30b9\u30c8\u5185\u306b\u4f55\u56de\u51fa\u73fe\u3059\u308b\u304b\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b <b>index()\u30e1\u30bd\u30c3\u30c9<\/b>: \u6307\u5b9a\u3057\u305f\u5024\u304c\u6700\u521d\u306b\u73fe\u308c\u308b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8fd4\u3059 <b>in\u6f14\u7b97\u5b50<\/b>: \u8981\u7d20\u304c\u30ea\u30b9\u30c8\u5185\u306b\u5b58\u5728\u3059\u308b\u304b\u3092True\/False\u3067\u8fd4\u3059<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">my_list = [10, 20, 30, 20, 40]\n\n# \u8981\u7d20\u306e\u6570\u3092\u6570\u3048\u308b\ncount_20 = my_list.count(20)\nprint(f\"20\u306e\u51fa\u73fe\u56de\u6570: {count_20}\")  # 2\n\n# \u8981\u7d20\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u53d6\u5f97\uff08\u6700\u521d\u306b\u898b\u3064\u304b\u3063\u305f\u3082\u306e\uff09\nindex_30 = my_list.index(30)\nprint(f\"30\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9: {index_30}\")  # 2\n\n# \u8981\u7d20\u306e\u5b58\u5728\u78ba\u8a8d\nexists = 30 in my_list\nnot_exists = 50 in my_list\nprint(f\"30\u306f\u5b58\u5728\u3059\u308b: {exists}\")      # True\nprint(f\"50\u306f\u5b58\u5728\u3059\u308b: {not_exists}\")  # False\n\n# \u5b58\u5728\u3057\u306a\u3044\u8981\u7d20\u3092\u691c\u7d22\u3059\u308b\u5834\u5408\u306e\u30a8\u30e9\u30fc\u51e6\u7406\ntry:\n    index = my_list.index(50)\nexcept ValueError:\n    print(\"\u6307\u5b9a\u3057\u305f\u5024\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\")\n<\/code><\/pre>\n<a href=\"https:\/\/www.udemy.com\/course\/python-python\/?couponCode=20260500_NM_PYTHON\" target=\"_blank\"><div class=\"affiliate-box\"><img decoding=\"async\" src=\"\/wp-content\/uploads\/2025\/09\/Python3.11.png\" alt=\"Python\u8b1b\u5ea7\" class=\"affiliate-img\"><div class=\"affiliate-text\"><h3 class=\"affiliate-title\">\u3010Udemy\u3011Python\u5165\u9580\u8b1b\u5ea7(0\u304b\u3089Python\u306e\u57fa\u790e\u3092\u4f53\u7cfb\u7684\u306b\u5b66\u3093\u3067\u3001\u751f\u6210AI\u3067\u30d0\u30a4\u30d6\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0)<\/h3><p class=\"affiliate-desc\">\u53d7\u8b1b\u751f3000\u4eba\u307b\u3069\u306e\u4eba\u6c17\u8b1b\u5ea7\u3002<strong>Python\u306e\u57fa\u790e\u304b\u3089\u751f\u6210AI\u6d3b\u7528<\/strong>\u307e\u3067\u3092<strong>20\u6642\u9593\u307b\u3069<\/strong>\u3067\u4e00\u6c17\u306b\u5b66\u3073\u307e\u3059\u3002\u696d\u52d9\u3067\u6d3b\u304b\u305b\u308bPython\u306e\u57fa\u790e\u77e5\u8b58\u306f\u3057\u3063\u304b\u308a\u3068\u8eab\u306b\u3064\u304d\u307e\u3059\u3002<\/p><\/div><\/div><\/a>\n<h2 class=\"title-border\">\u30bd\u30fc\u30c8\u3068\u9806\u5e8f\u5909\u66f4<\/h2>\n<p>\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u3092\u4e26\u3073\u66ff\u3048\u308b\u64cd\u4f5c\u3082\u3001Python\u3067\u306f\u7c21\u5358\u306b\u5b9f\u884c\u3067\u304d\u308b\u3002<\/p>\n<div class=\"sub-item\">\n<h3>\u7834\u58ca\u7684\u306a\u5909\u66f4\uff08\u5143\u306e\u30ea\u30b9\u30c8\u3092\u5909\u66f4\uff09<\/h3>\n<p><b>sort()\u30e1\u30bd\u30c3\u30c9<\/b>: \u30ea\u30b9\u30c8\u5185\u306e\u8981\u7d20\u3092\u76f4\u63a5\u30bd\u30fc\u30c8\u3059\u308b\uff08\u5143\u306e\u30ea\u30b9\u30c8\u3092\u5909\u66f4\uff09 <b>reverse()\u30e1\u30bd\u30c3\u30c9<\/b>: \u30ea\u30b9\u30c8\u306e\u8981\u7d20\u9806\u5e8f\u3092\u76f4\u63a5\u9006\u9806\u306b\u3059\u308b\uff08\u5143\u306e\u30ea\u30b9\u30c8\u3092\u5909\u66f4\uff09<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">numbers = [3, 1, 4, 1, 5, 9]\n\n# \u6607\u9806\u30bd\u30fc\u30c8\nnumbers.sort()\nprint(f\"\u6607\u9806: {numbers}\")  # [1, 1, 3, 4, 5, 9]\n\n# \u964d\u9806\u30bd\u30fc\u30c8\nnumbers.sort(reverse=True)\nprint(f\"\u964d\u9806: {numbers}\")  # [9, 5, 4, 3, 1, 1]\n\n# \u30ea\u30b9\u30c8\u3092\u9006\u9806\u306b\u3059\u308b\nfruits = [\"apple\", \"banana\", \"orange\"]\nfruits.reverse()\nprint(f\"\u9006\u9806: {fruits}\")  # [\"orange\", \"banana\", \"apple\"]\n<\/code><\/pre>\n<\/div>\n<div class=\"sub-item\">\n<h3>\u975e\u7834\u58ca\u7684\u306a\u5909\u66f4\uff08\u65b0\u3057\u3044\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\uff09<\/h3>\n<p><b>sorted()\u95a2\u6570<\/b>: \u5143\u306e\u30ea\u30b9\u30c8\u3092\u5909\u66f4\u305b\u305a\u306b\u65b0\u3057\u3044\u30bd\u30fc\u30c8\u3055\u308c\u305f\u30ea\u30b9\u30c8\u3092\u8fd4\u3059<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\">original = [3, 1, 4, 1, 5, 9]\n\n# sorted()\u95a2\u6570\u3092\u4f7f\u7528\uff08\u5143\u306e\u30ea\u30b9\u30c8\u306f\u5909\u66f4\u3055\u308c\u306a\u3044\uff09\nsorted_asc = sorted(original)\nsorted_desc = sorted(original, reverse=True)\n\nprint(f\"\u5143\u306e\u30ea\u30b9\u30c8: {original}\")      # [3, 1, 4, 1, 5, 9]\nprint(f\"\u6607\u9806\u30bd\u30fc\u30c8: {sorted_asc}\")    # [1, 1, 3, 4, 5, 9]\nprint(f\"\u964d\u9806\u30bd\u30fc\u30c8: {sorted_desc}\")   # [9, 5, 4, 3, 1, 1]\n<\/code><\/pre>\n<\/div>\n<a href=\"https:\/\/www.udemy.com\/course\/python-python\/?couponCode=20260500_NM_PYTHON\" target=\"_blank\"><div class=\"affiliate-box\"><img decoding=\"async\" src=\"\/wp-content\/uploads\/2025\/09\/Python3.11.png\" alt=\"Python\u8b1b\u5ea7\" class=\"affiliate-img\"><div class=\"affiliate-text\"><h3 class=\"affiliate-title\">\u3010Udemy\u3011Python\u5165\u9580\u8b1b\u5ea7(0\u304b\u3089Python\u306e\u57fa\u790e\u3092\u4f53\u7cfb\u7684\u306b\u5b66\u3093\u3067\u3001\u751f\u6210AI\u3067\u30d0\u30a4\u30d6\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0)<\/h3><p class=\"affiliate-desc\">\u53d7\u8b1b\u751f3000\u4eba\u307b\u3069\u306e\u4eba\u6c17\u8b1b\u5ea7\u3002<strong>Python\u306e\u57fa\u790e\u304b\u3089\u751f\u6210AI\u6d3b\u7528<\/strong>\u307e\u3067\u3092<strong>20\u6642\u9593\u307b\u3069<\/strong>\u3067\u4e00\u6c17\u306b\u5b66\u3073\u307e\u3059\u3002\u696d\u52d9\u3067\u6d3b\u304b\u305b\u308bPython\u306e\u57fa\u790e\u77e5\u8b58\u306f\u3057\u3063\u304b\u308a\u3068\u8eab\u306b\u3064\u304d\u307e\u3059\u3002<\/p><\/div><\/div><\/a>\n<h2 class=\"title-border\">\u30ea\u30b9\u30c8\u3068\u6587\u5b57\u5217\u306e\u76f8\u4e92\u5909\u63db<\/h2>\n<p>\u30ea\u30b9\u30c8\u3068\u6587\u5b57\u5217\u306f\u3001\u76f8\u4e92\u306b\u5909\u63db\u3067\u304d\u308b\u4fbf\u5229\u306a\u95a2\u4fc2\u306b\u3042\u308b\u3002 <b>split()\u30e1\u30bd\u30c3\u30c9<\/b>: \u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u305f\u533a\u5207\u308a\u6587\u5b57\u3067\u30ea\u30b9\u30c8\u306b\u5206\u5272\u3059\u308b <b>join()\u30e1\u30bd\u30c3\u30c9<\/b>: \u30ea\u30b9\u30c8\u306e\u8981\u7d20\u3092\u6307\u5b9a\u3057\u305f\u533a\u5207\u308a\u6587\u5b57\u3067\u7d50\u5408\u3057\u3066\u6587\u5b57\u5217\u306b\u3059\u308b<\/p>\n<pre class=\"line-numbers\"><code class=\"language-python\"># \u6587\u5b57\u5217\u3092\u30ea\u30b9\u30c8\u306b\u5206\u5272\ntext = \"Python programming is fun\"\nwords = text.split()  # \u7a7a\u767d\u3067\u5206\u5272\nprint(f\"\u5358\u8a9e\u30ea\u30b9\u30c8: {words}\")  # [\"Python\", \"programming\", \"is\", \"fun\"]\n\n# \u7279\u5b9a\u306e\u6587\u5b57\u3067\u5206\u5272\ncsv_data = \"apple,banana,orange\"\nfruits = csv_data.split(\",\")\nprint(f\"\u679c\u7269\u30ea\u30b9\u30c8: {fruits}\")  # [\"apple\", \"banana\", \"orange\"]\n\n# \u30ea\u30b9\u30c8\u3092\u6587\u5b57\u5217\u306b\u7d50\u5408\nword_list = [\"Hello\", \"World\", \"Python\"]\nsentence = \" \".join(word_list)  # \u7a7a\u767d\u3067\u7d50\u5408\nprint(f\"\u6587\u7ae0: {sentence}\")  # \"Hello World Python\"\n\n# \u7279\u5b9a\u306e\u533a\u5207\u308a\u6587\u5b57\u3067\u7d50\u5408\nhyphenated = \"-\".join([\"2025\", \"01\", \"15\"])\nprint(f\"\u65e5\u4ed8: {hyphenated}\")  # \"2025-01-15\"\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Python\u306e\u30ea\u30b9\u30c8\u578b\uff08list\uff09\u306b\u3064\u3044\u3066\u3001\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u5b9f\u8df5\u7684\u306a\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3059\u308b\u3002 \u30ea\u30b9\u30c8\u578b\u3068\u306f\u4f55\u304b \u30ea\u30b9\u30c8\u578b\u306f\u3001\u69d8\u3005\u306a\u30c7\u30fc\u30bf\u578b\u306e\u8981\u7d20\u3092\u683c\u7d0d\u3067\u304d\u3001\u9806\u5e8f\u4ed8\u3051\u3089\u308c\u3001\u5909\u66f4\u53ef\u80fd\uff08mutable\uff09\u306a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":341,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_uag_custom_page_level_css":"","_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[9,219],"tags":[62,14,61],"class_list":{"0":"post-336","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python","8":"category-it-programming","9":"tag-list","10":"tag-python","11":"tag-61","12":"entry"},"uagb_featured_image_src":{"full":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",720,480,false],"thumbnail":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480-150x150.jpg",150,150,true],"medium":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480-300x200.jpg",300,200,true],"medium_large":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",720,480,false],"large":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",720,480,false],"1536x1536":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",720,480,false],"2048x2048":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",720,480,false],"home-middle":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",525,350,false],"home-top":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",630,420,false],"sidebar-thumbnail":["https:\/\/www.nblog09.com\/w\/wp-content\/uploads\/2018\/12\/note-2527458__480.jpg",100,67,false]},"uagb_author_info":{"display_name":"9nmatsumoto","author_link":"https:\/\/www.nblog09.com\/w\/author\/9nmatsumoto\/"},"uagb_comment_info":2,"uagb_excerpt":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Python\u306e\u30ea\u30b9\u30c8\u578b\uff08list\uff09\u306b\u3064\u3044\u3066\u3001\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u5b9f\u8df5\u7684\u306a\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3059&hellip;","_links":{"self":[{"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/posts\/336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/comments?post=336"}],"version-history":[{"count":70,"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/posts\/336\/revisions"}],"predecessor-version":[{"id":5190,"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/posts\/336\/revisions\/5190"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/media\/341"}],"wp:attachment":[{"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/media?parent=336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/categories?post=336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nblog09.com\/w\/wp-json\/wp\/v2\/tags?post=336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}