{"id":3536,"date":"2026-12-01T13:24:59","date_gmt":"2026-12-01T04:24:59","guid":{"rendered":"https:\/\/danlabs.kr\/?p=3536"},"modified":"2026-12-01T13:25:56","modified_gmt":"2026-12-01T04:25:56","slug":"python-str-partition-20261201","status":"publish","type":"post","link":"https:\/\/danlabs.kr\/?p=3536","title":{"rendered":"Python str.partition: \uad6c\ubd84\uc790 \ub204\ub77d\uacfc \ube48 \uac12\uc744 \ub098\ub204\ub294 \ubc95"},"content":{"rendered":"<p>\uc124\uc815 \uc904\uc5d0\uc11c <code>token=<\/code>\uc740 \uac12\uc744 \ube44\uc6cc \ub454 \uc785\ub825\uc774\uace0, <code>token<\/code>\uc740 <code>=<\/code> \uc5c6\uc774 \ub4e4\uc5b4\uc628 \uc785\ub825\uc774\uc5d0\uc694. \ub458\uc744 \ub2e4\ub978 \uc624\ub958\ub85c \ub2e4\ub904\uc57c \ud55c\ub2e4\uba74 Python\uc758 <code>str.partition('=')<\/code>\uac00 \ud3b8\ud574\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup> \uac12\uc774 \ube44\uc5b4 \uc788\uc5b4\ub3c4 \uac00\uc6b4\ub370 \uce78\uc5d0 \uad6c\ubd84\uc790\uac00 \ub0a8\uc544\uc11c, <code>=<\/code>\uac00 \uc788\uc5c8\ub294\uc9c0 \ub530\ub85c \uc54c \uc218 \uc788\uc5b4\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup><\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-inline1.jpg\" alt=\"str.partition\uc774 \ub3cc\ub824\uc8fc\ub294 \uc55e\ubd80\ubd84, \uad6c\ubd84\uc790, \ub4b7\ubd80\ubd84\uc744 \ub098\ud0c0\ub0b8 \uc0dd\uc131 \ub3c4\uc2dd\" width=\"1280\" height=\"720\" loading=\"lazy\"><\/figure>\n<p><em>\ub300\ud45c \uc774\ubbf8\uc9c0\uc640 \ubcf8\ubb38\uc758 \ub3c4\uc2dd\uc740 \ubb38\uc790\uc5f4 \ucc98\ub9ac \uacfc\uc815\uc744 \uc124\uba85\ud558\uae30 \uc704\ud55c \uc0dd\uc131 \uac1c\ub150 \uc774\ubbf8\uc9c0\uc608\uc694.<\/em><\/p>\n<h2>\uccab \ubc88\uc9f8 \ub4f1\ud638\ub9cc \uae30\uc900\uc73c\ub85c \uc798\ub77c\uc694<\/h2>\n<p>Python \uacf5\uc2dd \ubb38\uc11c\uc5d0\uc11c <code>partition()<\/code>\uc740 \uc9c0\uc815\ud55c \uad6c\ubd84\uc790\uac00 \ucc98\uc74c \ub098\ud0c0\ub098\ub294 \uc704\uce58\uc5d0\uc11c \ubb38\uc790\uc5f4\uc744 \ub098\ub204\uace0, <strong>\uc55e\ubd80\ubd84\u00b7\uad6c\ubd84\uc790\u00b7\ub4b7\ubd80\ubd84<\/strong>\uc744 \ub2f4\uc740 \uc138 \ud56d\ubaa9\uc758 \ud29c\ud50c\uc744 \ub3cc\ub824\uc918\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup> <code>token=abc=def<\/code>\uc5d0\uc11c\ub294 \uccab <code>=<\/code>\ub9cc \uacbd\uacc4\ub85c \uc4f0\ubbc0\ub85c \uac12\uc5d0 \ub4e4\uc5b4 \uc788\ub294 \ub450 \ubc88\uc9f8 <code>=<\/code>\ub294 <code>abc=def<\/code>\uc5d0 \uadf8\ub300\ub85c \ub0a8\uc544\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup><\/p>\n<p>\uad6c\ubd84\uc790\uac00 \uc5c6\ub2e4\uba74 \ubc18\ud658 \ubaa8\uc591\uc740 \uadf8\ub300\ub85c\uc608\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup> \uc6d0\ub798 \ubb38\uc790\uc5f4\uc774 \uccab \uce78\uc5d0 \uc624\uace0, \uac00\uc6b4\ub370\uc640 \ub9c8\uc9c0\ub9c9\uc5d0\ub294 \ube48 \ubb38\uc790\uc5f4\uc774 \ub4e4\uc5b4\uac00\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup> \ubc18\ud658\uac12\uc758 \uae38\uc774\ub97c \uac80\uc0ac\ud560 \ud544\uc694 \uc5c6\uc774 \uc138 \ubcc0\uc218\uc5d0 \ubc14\ub85c \ud480\uc5b4 \ub2f4\uc744 \uc218 \uc788\ub294 \uc774\uc720\uc608\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup><\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-inline2.jpg\" alt=\"\uad6c\ubd84\uc790\uac00 \uc5c6\uc744 \ub54c \uc6d0\ub798 \ubb38\uc790\uc5f4\uacfc \ube48 \ubb38\uc790\uc5f4 \ub450 \uac1c\ub97c \ub3cc\ub824\uc8fc\ub294 \uc0dd\uc131 \ub3c4\uc2dd\" width=\"1280\" height=\"720\" loading=\"lazy\"><\/figure>\n<h2>\uac00\uc6b4\ub370 \uce78\uc73c\ub85c \uad6c\ubd84\uc790 \ub204\ub77d\uc744 \uc54c\uc544\ub0b4\uc694<\/h2>\n<p><code>token=<\/code>\uacfc <code>token<\/code>\uc740 \ub458 \ub2e4 \ub9c8\uc9c0\ub9c9 \uce78\uc774 \ube44\uc5b4 \uc788\uc5b4\uc11c, \ub9c8\uc9c0\ub9c9 \uce78\ub9cc \uac80\uc0ac\ud558\uba74 \ub204\ub77d\uacfc \ube48 \uac12\uc744 \uad6c\ubcc4\ud560 \uc218 \uc5c6\uc5b4\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup> \uc544\ub798 \ucf54\ub4dc\ub294 \uac00\uc6b4\ub370\uc758 <code>sep<\/code>\uc744 \uc0b4\ud3b4\ubcf4\uace0, \ube48 \uac12\uc740 \uadf8\ub300\ub85c \ucd9c\ub825\ud558\ub418 \ub4f1\ud638\uac00 \uc5c6\ub294 \uc904\uc740 \ub530\ub85c \ucc98\ub9ac\ud574\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup><\/p>\n<pre><code class=\"language-python\">samples = ('token=abc=def', 'token=', 'token')\nexpected = [('token', '=', 'abc=def'), ('token', '=', ''), ('token', '', '')]\nfor line, triplet in zip(samples, expected):\n    parts = line.partition('=')\n    assert parts == triplet\n    key, sep, value = parts\n    if not sep:\n        print(f'{line!r}: missing separator')\n    else:\n        print(f'{line!r}: {key=}, {value=}')\nprint('split:', samples[0].split('=', 1))\nassert samples[0].split('=', 1) == ['token', 'abc=def']<\/code><\/pre>\n<p>Python 3.14.9\uc5d0\uc11c \uc608\uc81c\ub97c \uc2e4\ud589\ud55c \ucd9c\ub825\uc774\uc5d0\uc694. <code>token=<\/code>\uc740 \uac12\uc774 \ube48 \ubb38\uc790\uc5f4\ub85c \ub0a8\uc558\uace0, <code>token<\/code>\uc5d0\ub9cc \uad6c\ubd84\uc790 \ub204\ub77d \uba54\uc2dc\uc9c0\uac00 \ub098\uc654\uc5b4\uc694.<\/p>\n<pre><code class=\"language-text\">'token=abc=def': key='token', value='abc=def'\n'token=': key='token', value=''\n'token': missing separator\nsplit: ['token', 'abc=def']<\/code><\/pre>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-inline3.jpg\" alt=\"\uac12\uc774 \ube44\uc5b4 \uc788\uc5b4\ub3c4 str.partition\uc758 \uac00\uc6b4\ub370 \uce78\uc5d0\ub294 \uad6c\ubd84\uc790\uac00 \ub0a8\ub294 \uc0dd\uc131 \ub3c4\uc2dd\" width=\"1280\" height=\"720\" loading=\"lazy\"><\/figure>\n<h2><code>split('=', 1)<\/code>\uacfc \ub2ec\ub77c\uc9c0\ub294 \uac74 \ubc18\ud658 \ubaa8\uc591\uc774\uc5d0\uc694<\/h2>\n<p><code>split('=', 1)<\/code>\ub3c4 \ubd84\ud560 \ud69f\uc218\ub97c \ud55c \ubc88\uc73c\ub85c \uc81c\ud55c\ud558\ubbc0\ub85c <code>abc=def<\/code>\ub97c \ud1b5\uc9f8\ub85c \ub0a8\uaca8\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup> \ucc28\uc774\ub294 \ubc18\ud658\uac12\uc774\uc5d0\uc694. <code>split()<\/code>\uc740 \ubd84\ud560\ub41c \ubd80\ubd84\uc744 \ub9ac\uc2a4\ud2b8\ub85c \ub3cc\ub824\uc918\uc11c, \uc774 \uc608\uc81c\uc5d0\uc11c \uad6c\ubd84\uc790\uac00 \uc788\uc73c\uba74 \ub450 \ud56d\ubaa9, \uc5c6\uc73c\uba74 \ud55c \ud56d\ubaa9\uc774\uc5d0\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup> \uc870\uac01\uc758 \uac1c\uc218\ub85c \ud615\uc2dd \uc624\ub958\ub97c \uac00\ub824\ub0b4\ub294 \uae30\uc874 \ucf54\ub4dc\ub77c\uba74 <code>split()<\/code>\ub3c4 \ub9de\uace0, \uccab \uad6c\ubd84\uc790 \uc720\ubb34\ub97c \uac19\uc740 \ubaa8\uc591\uc758 \ubc18\ud658\uac12\uc73c\ub85c \ubc1b\uace0 \uc2f6\ub2e4\uba74 <code>partition()<\/code>\uc774 \ub354 \uc9c1\uc811\uc801\uc774\uc5d0\uc694.<sup><a href=\"#source-1\">[1]<\/a><\/sup><\/p>\n<p>\uad00\ub828 \uae00: <a href=\"https:\/\/danlabs.kr\/?p=3137\">Python csv.DictReader\ub85c CSV \uc77d\uae30, \uc5f4 \ub204\ub77d\uacfc \ucd08\uacfc\ub97c \uad6c\ubd84\ud574\uc694<\/a><\/p>\n<p><strong>Sources<\/strong><\/p>\n<ol>\n<li id=\"source-1\"><a href=\"https:\/\/docs.python.org\/3.14\/builtins\/stdtypes.html\" target=\"_blank\" rel=\"noopener noreferrer\">Python 3.14 \uacf5\uc2dd \ubb38\uc11c \u2014 str.partition\u00b7str.split (2026-12-01 \uc870\ud68c)<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Python str.partition\uc73c\ub85c \uc124\uc815 \uc904\uc744 \uccab \ub4f1\ud638\uc5d0\uc11c \ub098\ub204\uace0 \ube48 \uac12\uacfc \uad6c\ubd84\uc790 \ub204\ub77d\uc744 \uac00\ub824\uc694. \uc2e4\uc81c \uc2e4\ud589 \uacb0\uacfc\ub85c split\uacfc \ubc18\ud658\uac12\uc758 \ucc28\uc774\ub3c4 \ube44\uad50\ud574\uc694.<\/p>\n","protected":false},"author":1,"featured_media":3532,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-3536","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"featured_image_urls":{"full":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat.jpg",1280,720,false],"thumbnail":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat-150x150.jpg",150,150,true],"medium":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat-300x169.jpg",300,169,true],"medium_large":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat-768x432.jpg",640,360,true],"large":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat-1024x576.jpg",640,360,true],"1536x1536":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat.jpg",1280,720,false],"2048x2048":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat.jpg",1280,720,false],"morenews-large":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat-825x575.jpg",825,575,true],"morenews-medium":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat-590x410.jpg",590,410,true],"danlabs-list-small":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat-366x190.jpg",366,190,true],"danlabs-list-retina":["https:\/\/danlabs.kr\/wp-content\/uploads\/2026\/12\/python-str-partition-20261201-feat.jpg",1280,720,false]},"author_info":{"display_name":"DanLABs","author_link":"https:\/\/danlabs.kr\/author\/hello-danlabs-kr"},"category_info":"<a href=\"https:\/\/danlabs.kr\/?cat=19\" rel=\"category\">\uac1c\ubc1c<\/a>","tag_info":"\uac1c\ubc1c","comment_count":"0","_links":{"self":[{"href":"https:\/\/danlabs.kr\/index.php?rest_route=\/wp\/v2\/posts\/3536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/danlabs.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/danlabs.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/danlabs.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/danlabs.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3536"}],"version-history":[{"count":1,"href":"https:\/\/danlabs.kr\/index.php?rest_route=\/wp\/v2\/posts\/3536\/revisions"}],"predecessor-version":[{"id":3537,"href":"https:\/\/danlabs.kr\/index.php?rest_route=\/wp\/v2\/posts\/3536\/revisions\/3537"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/danlabs.kr\/index.php?rest_route=\/wp\/v2\/media\/3532"}],"wp:attachment":[{"href":"https:\/\/danlabs.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/danlabs.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/danlabs.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}