{"id":7194,"date":"2021-03-03T07:11:05","date_gmt":"2021-03-03T06:11:05","guid":{"rendered":"https:\/\/myoceane.fr\/?p=7194"},"modified":"2021-03-19T02:57:06","modified_gmt":"2021-03-19T01:57:06","slug":"python-strings","status":"publish","type":"post","link":"https:\/\/myoceane.fr\/index.php\/python-strings\/","title":{"rendered":"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<h3>Python Data Types \u8cc7\u6599\u985e\u578b &#8211; Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0<span style=\"color: #ff0000;\">( )<\/span>\u00a0\uff09<\/h3>\n<table style=\"border-collapse: collapse; width: 100%; height: 210px;\">\n<tbody>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">\n<h6>No.<\/h6>\n<\/td>\n<td style=\"width: 56.8689%; height: 19px;\">\n<h6>Strings \u5b57\u4e32\u7528\u6cd5<\/h6>\n<\/td>\n<td style=\"width: 37.1672%; height: 19px;\">\n<h6>\u8a3b<\/h6>\n<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">1<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#string\"><strong>Strings \u7528\u300c\u96d9\u5f15\u865f\u300d\u6216\u300c\u55ae\u5f15\u865f\u300d\u8868\u793a<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">(<span style=\"color: #ff0000;\">&#8220;<\/span>\u5b57\u4e32<span style=\"color: #ff0000;\">&#8220;<\/span>)\u00a0 \u6216 (<span style=\"color: #ff0000;\">&#8216;<\/span>\u5b57\u4e32<span style=\"color: #ff0000;\">&#8216;<\/span>)<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">2<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#strings\"><strong>Strings \u70ba\u591a\u91cd\u5b57\u4e32\u6642\uff0c\u53ef\u7528\u4e09\u6b21\u91cd\u8907\u7684\u300c\u96d9\u5f15\u865f\u300d\u6216\u300c\u55ae\u5f15\u865f\u300d<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">(<span style=\"color: #ff0000;\">&#8220;&#8221;&#8221;<\/span>\u00a0\u591a\u91cd\u5b57\u4e32<span style=\"color: #ff0000;\"> &#8220;&#8221;&#8221;<\/span>)\u00a0 \u6216 (<span style=\"color: #ff0000;\">&#8221;&#8217;<\/span>\u00a0\u591a\u91cd\u5b57\u4e32 <span style=\"color: #ff0000;\">&#8221;&#8217;<\/span>)<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 20px;\">3<\/td>\n<td style=\"width: 56.8689%; height: 20px;\"><a href=\"#array\"><strong>Strings \u70ba\u4e00\u7a2e\u77e9\u9663\uff08Array\uff09<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 20px;\">\u77e9\u9663\u5167\u4f4d\u7f6e\uff08\u7528\u4e2d\u62ec\u865f<span style=\"color: #0000ff;\"><strong> [ ] <\/strong><\/span>\u8868\u793a\uff09<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">4<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#slicing\"><strong>Slicing Strings \u5b57\u4e32\u7247\u6bb5<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">\u5229\u7528\u77e9\u9663\u5167\u4f4d\u7f6e\u6982\u5ff5\uff08<span style=\"color: #0000ff;\"><strong>[ ]<\/strong><\/span>\uff09<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">5<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#looping\"><strong>Strings \u505a\u4e00\u500b\u8ff4\u5708\uff08Looping\uff09<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">Strings \u70ba\u4e00\u7a2e<span style=\"color: #ff0000;\">\u77e9\u9663<\/span>\uff0c\u53ef\u4ee5\u5229\u7528\u5b57\u6bcd\u505a\u8ff4\u5708\uff08\u4f7f\u7528\uff1a<span style=\"color: #ff0000;\">for<\/span> \uff09<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">6<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#length\"><strong>Strings Length \u9577\u5ea6<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">\u5229\u7528<span style=\"color: #ff0000;\"> len ( )<\/span> \u8868\u793a<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">7<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#search\"><strong>\u67e5\u770b Strings \u5167\u7684 \u5b57\u4e32 \u6216 \u5b57\u6bcd<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">\u5229\u7528<span style=\"color: #ff0000;\"> in<\/span> \u8868\u793a\uff0c\u4e26\u5229\u7528 <br \/>1)<span style=\"color: #ff0000;\">\u00a0if<\/span> \u5047\u8a2d\uff0c\u67e5\u627e\u5b57\u662f\u5426\u51fa\u73fe ( <span style=\"color: #ff0000;\">in<\/span> )\u5728 strings \u4e2d \u6216 <br \/>2) <span style=\"color: #ff0000;\">if<\/span> \u5047\u8a2d\uff0c\u67e5\u627e\u5b57<span style=\"color: #ff0000;\">\u672a<\/span>\u51fa\u73fe (<span style=\"color: #ff0000;\"> not in<\/span> ) \u5728 string \u4e2d<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">8<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#modify\"><strong>Modify Strings \u4fee\u6539\u5b57\u4e32<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">1) \u5927\u5beb <span style=\"color: #ff0000;\">upper ( )<span style=\"color: #000000;\"><br \/><\/span><\/span>2) \u5c0f\u5beb <span style=\"color: #ff0000;\">lower ( )<br \/><\/span>3) \u522a\u9664 Strings \u524d\u5f8c\u7a7a\u683c <span style=\"color: #ff0000;\">strip\u00a0( )<span style=\"color: #000000;\"><br \/><\/span><\/span>4) \u66ff\u63db\u5b57\u6bcd <span style=\"color: #ff0000;\">replace ( )<span style=\"color: #000000;\"><br \/><\/span><\/span>5) \u5206\u5272\u5b57\u4e32 <span style=\"color: #ff0000;\">split ( )<\/span><\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">9<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#concatenation\"><strong>String concatenation \u4e32\u806f\u5b57\u4e32<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">\u5229\u7528\u52a0\u865f <span style=\"color: #ff0000;\">+ <\/span>\u8868\u793a<\/td>\n<\/tr>\n<tr style=\"height: 19px;\">\n<td style=\"width: 5.96376%; height: 19px;\">10<\/td>\n<td style=\"width: 56.8689%; height: 19px;\"><a href=\"#format\"><strong>String Format \u5b57\u4e32\u683c\u5f0f<\/strong><\/a><\/td>\n<td style=\"width: 37.1672%; height: 19px;\">\u5229\u7528<span style=\"color: #ff0000;\"> format ()<\/span> \u5c07<span style=\"color: #ff0000;\">\u5b57\u4e32<\/span>\u548c<span style=\"color: #ff0000;\">\u6578\u5b57<\/span>\u7d50\u5408<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u00a0<\/h3>\n<h3>1. Strings \u7528\u300c\u96d9\u5f15\u865f\u300d\u6216\u300c\u55ae\u5f15\u865f\u300d\u8868\u793a\uff1a\uff08 (<span style=\"color: #ff0000;\">&#8220;<\/span>\u5b57\u4e32<span style=\"color: #ff0000;\">&#8220;<\/span>)\u00a0 \u6216 (<span style=\"color: #ff0000;\">&#8216;<\/span>\u5b57\u4e32<span style=\"color: #ff0000;\">&#8216;<\/span>) \uff09<a id=\"string\"><\/a><\/h3>\n<pre class=\"lang:python\">print(<span style=\"color: #ff0000;\">\"<\/span>Oceane<span style=\"color: #ff0000;\">\"<\/span>)<\/pre>\n<pre class=\"lang:python\">Oceane<\/pre>\n<p>\u53c8\u6216\u8005<\/p>\n<pre class=\"lang:python\">print(<span style=\"color: #ff0000;\">'<\/span>Oceane<span style=\"color: #ff0000;\">'<\/span>)<\/pre>\n<div class=\"cell code_cell rendered unselected\" tabindex=\"2\">\n<div class=\"input\">\n<div class=\"inner_cell\">\n<div class=\"input_area\" aria-label=\"Edit code here\">\n<div class=\"CodeMirror cm-s-ipython\">\n<div class=\"cell code_cell rendered unselected\" tabindex=\"2\">\n<div class=\"input\">\n<div class=\"inner_cell\">\n<div class=\"input_area\" aria-label=\"Edit code here\">\n<div>\n<pre class=\"lang:python\">Oceane<\/pre>\n<\/div>\n<div class=\"CodeMirror cm-s-ipython\"># \u4e0d\u8ad6\u7528\u300c\u96d9\u5f15\u865f\u300d\u6216\u300c\u55ae\u5f15\u865f\u300d\uff0c\u51fa\u4f86\u7684\u7d50\u679c\u7686\u70ba\uff1aOceane<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>\u00a0<\/h3>\n<h3>2. Strings \u70ba\u591a\u91cd\u5b57\u4e32\u6642\uff0c\u53ef\u7528\u4e09\u6b21\u91cd\u8907\u7684\u300c\u96d9\u5f15\u865f\u300d\u6216\u300c\u55ae\u5f15\u865f\u300d\uff1a<a id=\"strings\"><\/a><br \/>\uff08 (<span style=\"color: #ff0000;\">&#8220;&#8221;&#8221;<\/span>\u00a0\u591a\u91cd\u5b57\u4e32<span style=\"color: #ff0000;\"> &#8220;&#8221;&#8221;<\/span>)\u00a0 \u6216 (<span style=\"color: #ff0000;\">&#8221;&#8217;<\/span>\u00a0\u591a\u91cd\u5b57\u4e32 <span style=\"color: #ff0000;\">&#8221;&#8217;<\/span>) \uff09<\/h3>\n<pre class=\"lang:python\">a = <span style=\"color: #ff0000;\">\"\"\"<\/span> Hi, my name is Oceane. Nice to meet you! <span style=\"color: #ff0000;\">\"\"\"<\/span><\/pre>\n<pre class=\"lang:python\">print(a)<\/pre>\n<pre class=\"lang:python\">Hi, my name is Oceane. Nice to meet you!<\/pre>\n\n\n<p>\u53c8\u6216\u8005<\/p>\n\n\n<pre class=\"lang:python\">a = ''' Hi, my name is Oceane. Nice to meet you! '''<\/pre>\n<pre class=\"lang:python\">print(b)<\/pre>\n<pre class=\"lang:python\">Hi, my name is Oceane. Nice to meet you!<\/pre>\n<p># \u4e0d\u8ad6\u7528\u4e09\u6b21\u91cd\u8907\u7684\u300c\u96d9\u5f15\u865f\u300d\u6216\u300c\u55ae\u5f15\u865f\u300d\uff0c\u51fa\u4f86\u7684\u7d50\u679c\u7686\u70ba\uff1aHi, my name is Oceane. Nice to meet you!<\/p>\n\n\n<p><\/p>\n\n\n<h3>3. Strings \u70ba\u4e00\u7a2e\u77e9\u9663\uff08Array\uff09\uff1a\u77e9\u9663\u5167\u4f4d\u7f6e\uff08\u7528\u4e2d\u62ec\u865f<span style=\"color: #0000ff;\"> [ ]<\/span> \u8868\u793a\uff09<a id=\"array\"><\/a><\/h3>\n<pre class=\"lang:python\">a = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(a[1])<\/pre>\n<pre class=\"lang:python\">e<\/pre>\n<p># Strings \u70ba\u4e00\u7a2e<span style=\"color: #ff0000;\">\u77e9\u9663<\/span>\uff0c\u7576 a = &#8220;Hello, Oceane !&#8221;\uff0c\u5247\u7b2c\u4e00\u500b\u4f4d\u7f6e\uff08\u7528\u4e2d\u62ec\u865f<span style=\"color: #0000ff;\"><strong> [ ]<\/strong> <\/span>\u8868\u793a\uff09\u70ba e\u3002<br>\u7b2c<span style=\"color: #0000ff;\">0<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[0] <\/span>)\uff09\uff1aH<br>\u7b2c<span style=\"color: #0000ff;\">1<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[1] <\/span>)\uff09\uff1ae<br>\u7b2c<span style=\"color: #0000ff;\">2<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[2] <\/span>)\uff09\uff1al<br>\u7b2c<span style=\"color: #0000ff;\">3<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[3] <\/span>)\uff09\uff1al<br>\u7b2c<span style=\"color: #0000ff;\">4<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[4] <\/span>)\uff09\uff1ao<br>\u7b2c<span style=\"color: #0000ff;\">5<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[5] <\/span>)\uff09\uff1a,<br>\u7b2c<span style=\"color: #0000ff;\">6<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[6] <\/span>)\uff09\uff1a \uff08\u7a7a\u683c\uff09<br>\u7b2c<span style=\"color: #0000ff;\">7<\/span>\u500b\u4f4d\u7f6e\u70ba\uff08print ( a <span style=\"color: #0000ff;\">[7] <\/span>)\uff09\uff1aO<br>\u4ee5\u6b64\u985e\u63a8&#8230;<\/p>\n\n\n<p><\/p>\n\n\n<h3>4. Slicing Strings \u5b57\u4e32\u7247\u6bb5\uff1a\u5229\u7528\u77e9\u9663\u5167\u4f4d\u7f6e\u6982\u5ff5\uff08<strong><span style=\"color: #0000ff;\">[ ]<\/span><\/strong>\uff09<a id=\"slicing\"><\/a><\/h3>\n<pre class=\"lang:python\">b = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(b[2:5])<\/pre>\n<pre class=\"lang:python\">llo<\/pre>\n<p># \u7576 b = &#8220;Hello, Oceane !&#8221;\uff0c\u5247<span style=\"color: #0000ff;\">\u7b2c2<\/span>\u5230\u7b2c5\u500b\u4f4d\u7f6e\u4e4b\u524d\uff08\u5373<span style=\"color: #0000ff;\">\u7b2c4<\/span>\u500b\u4f4d\u7f6e\uff09\u70ba llo\u3002\uff08<strong>\u6ce8\u610f\uff1a\u7b2c\u4e00\u500b\u5b57\u6bcd\u70ba\u4f4d\u7f6e<span style=\"color: #ff0000;\"> 0<\/span><\/strong>\uff09<\/p>\n<p><\/p>\n<p>\u53c8\u6216\u8005<\/p>\n<pre class=\"lang:python\">b = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(b[:5])<\/pre>\n<pre class=\"lang:python\">Hello<\/pre>\n<p># <span style=\"color: #000000;\">\u5247\u5f9e\u982d\uff08<span style=\"color: #0000ff;\">\u7b2c0<\/span>\u500b\u4f4d\u7f6e\uff09\u5230\u7b2c5\u500b\u4f4d\u7f6e\u4e4b\u524d\uff08\u5373<span style=\"color: #0000ff;\">\u7b2c4<\/span>\u500b\u4f4d\u7f6e\uff09\u70ba<\/span> Hello\u3002<\/p>\n<p><\/p>\n<p>\u53c8\u6216\u8005<\/p>\n<pre class=\"lang:python\">b = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(b[2:])<\/pre>\n<pre class=\"lang:python\">llo, Oceane!<\/pre>\n<p># <span style=\"color: #000000;\">\u5247\u5f9e\u982d\uff08<span style=\"color: #0000ff;\">\u7b2c2<\/span>\u500b\u4f4d\u7f6e\uff09\u5230\u6700\u5f8c\u70ba<\/span> llo, Oceane!\u3002<\/p>\n<p><\/p>\n<p>\u53c8\u6216\u8005<\/p>\n<pre class=\"lang:python\">b = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(b[-5:-2])<\/pre>\n<pre class=\"lang:python\">ean<\/pre>\n<p># <span style=\"color: #000000;\">\u5247<span style=\"color: #0000ff;\">\u5012\u6578\u7b2c5<\/span>\u500b\u4f4d\u7f6e\u5230<span style=\"color: #0000ff;\">\u5012\u6578\u7b2c2<span style=\"color: #000000;\">\u500b\u4f4d\u7f6e<\/span>\uff0c<\/span>\u70ba ean<\/span>\u3002<\/p>\n<p><\/p>\n<h3>5. Strings \u505a\u4e00\u500b\u8ff4\u5708\uff08Looping\uff09\uff1a<a id=\"looping\"><\/a><br>Strings \u70ba\u4e00\u7a2e<span style=\"color: #ff0000;\">\u77e9\u9663<\/span>\uff0c\u53ef\u4ee5\u5229\u7528\u5b57\u6bcd\u505a\u8ff4\u5708\uff08\u4f7f\u7528\uff1a<span style=\"color: #ff0000;\">for<\/span> \uff09<\/h3>\n<pre class=\"lang:python\">for x in \"Oceane\": <br>  print(x)<\/pre>\n<pre class=\"lang:python\">O \nc \ne \na \nn \ne<\/pre>\n<p># \u7576 Strings \u70ba\u4e00\u7a2e<span style=\"color: #ff0000;\">\u77e9\u9663<\/span>\uff0c\u53ef\u4ee5\u5229\u7528\u5b57\u6bcd\u505a\u8ff4\u5708\uff08\u4f7f\u7528\uff1a<span style=\"color: #ff0000;\">for<\/span> \uff09\u3002\u8a3b\uff1a\u7576 for x in &#8220;Oceane&#8221; \u5f8c\u9762\u63a5\u8457 print (x)\uff0c\u9808\u5c07 print(x) \u5229\u7528 tab\u9375\u79fb\u81f3\u5f8c\u9762\u4e00\u683c\u3002<br>\u7d50\u679c\u4ee3\u8868\uff1a<br>x \u8dd1\u7b2c 1 \u6b21\u8ff4\u5708 Loop\uff0c\u51fa\u73fe O<br>x \u8dd1\u7b2c 2 \u6b21\u8ff4\u5708 Loop\uff0c\u51fa\u73fe c<br>x \u8dd1\u7b2c 3 \u6b21\u8ff4\u5708 Loop\uff0c\u51fa\u73fe e<br>x \u8dd1\u7b2c 4 \u6b21\u8ff4\u5708 Loop\uff0c\u51fa\u73fe a<br>x \u8dd1\u7b2c 5 \u6b21\u8ff4\u5708 Loop\uff0c\u51fa\u73fe n<br>x \u8dd1\u7b2c 6 \u6b21\u8ff4\u5708 Loop\uff0c\u51fa\u73fe e<\/p>\n\n\n<p><\/p>\n\n\n<h3>6. Strings Length \u9577\u5ea6\uff1a\u5229\u7528<span style=\"color: #ff0000;\"> len ( )<\/span> \u8868\u793a<a id=\"length\"><\/a><\/h3>\n<pre class=\"lang:python\">a = \"Hello, Oceane!\" \n\t\tprint(len(a))<\/pre>\n<pre class=\"lang:python\">14<\/pre>\n<p># \u8868\u793a\u6b64\u5b57\u4e32\u9577\u5ea6\u70ba\uff1a14\uff08\u5305\u542b\u6a19\u9ede\u7b26\u865f\u53ca\u7a7a\u683c\uff09\u3002<\/p>\n<p><\/p>\n<h3>7. \u67e5\u770b Strings \u5167\u7684\u5b57\u4e32 \u6216 \u5b57\u6bcd\uff1a\u5229\u7528<span style=\"color: #ff0000;\"> in<\/span>&nbsp;\u8868\u793a<a id=\"search\"><\/a><\/h3>\n<pre class=\"lang:python\">txt = \"Oceane is a cute girl!\" \n\tprint(\"cute\" in txt)<\/pre>\n<pre class=\"lang:python\">True<\/pre>\n\n\n<p># cute \u51fa\u73fe\u5728\u6b64 string \u4e2d\uff0c\u56e0\u6b64\u7d50\u679c\u70ba\uff1aTrue\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n<p>\u5229\u7528<span style=\"color: #ff0000;\"> if<\/span> \u5047\u8a2d\uff0c\u5b57\u51fa\u73fe ( <span style=\"color: #ff0000;\">in<\/span> )\u5728 string \u4e2d<\/p>\n<pre class=\"lang:python\">txt = \"Oceane is a cute girl!\"\nif \"cute\" in txt: \n  print(\"Yes, 'cute' is present\")<\/pre>\n<pre class=\"lang:python\">Yes, 'cute' is present<\/pre>\n\n\n<p># \u5229\u7528 if\uff1aif cute \u51fa\u73fe\u5728\u6b64 string \u4e2d\uff0c\u5247 print &#8221; Yes, &#8216;cute&#8217; is present &#8220;\u3002<\/p>\n\n\n<p>\u4f46\uff0c<\/p>\n<p>\u5229\u7528<span style=\"color: #ff0000;\"> if<\/span> \u5047\u8a2d\uff0c\u5b57<span style=\"color: #ff0000;\">\u672a<\/span>\u51fa\u73fe (<span style=\"color: #ff0000;\"> not in<\/span> ) \u5728 string \u4e2d<\/p>\n<pre class=\"lang:python\">txt = \"Oceane is a cute girl!\"\nif \"boy\" not in txt: \n\t\tprint(\"Yes, 'boy' is NOT present\")<\/pre>\n<pre class=\"lang:python\">Yes, 'boy' is NOT present<\/pre>\n\n\n<p># \u5229\u7528 if\uff1aif boy \u672a\u51fa\u73fe\u5728\u6b64 string \u4e2d\uff0c\u5247 print &#8221; Yes, &#8216;boy&#8217; is NOT present &#8220;\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n<h3>8. Modify Strings \u4fee\u6539\u5b57\u4e32\uff1a<a id=\"modify\"><\/a><br>1) \u5927\u5beb <span style=\"color: #ff0000;\">upper ( )<span style=\"color: #000000;\"><br><\/span><\/span>2) \u5c0f\u5beb <span style=\"color: #ff0000;\">lower ( )<span style=\"color: #000000;\"><br><\/span><\/span>3) \u522a\u9664 Strings \u524d\u5f8c\u7a7a\u683c <span style=\"color: #ff0000;\">strip&nbsp;( )<span style=\"color: #000000;\"><br><\/span><\/span>4) \u66ff\u63db\u5b57\u6bcd <span style=\"color: #ff0000;\">replace ( )<span style=\"color: #000000;\"><br><\/span><\/span>5) \u5206\u5272\u5b57\u4e32 <span style=\"color: #ff0000;\">split ( )<\/span><\/h3>\n<h4>&nbsp;<\/h4>\n<h4>1) \u5927\u5beb <span style=\"color: #ff0000;\">upper ( )<\/span><\/h4>\n<pre class=\"lang:python\">a = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(a.upper())<\/pre>\n<pre class=\"lang:python\">HELLO, OCEANE!<\/pre>\n<p># \u5c07 print (a) \u518d\u52a0\u4e0a <span style=\"color: #ff0000;\">upper ()<\/span> \uff0c\u5247\u7d50\u679c\u6703\u8b93\u6240\u6709 Strings \u88e1\u9762\u7684\u5b57\u6bcd\u8b8a\u6210<span style=\"color: #ff0000;\">\u5927\u5beb<\/span>\u3002<\/p>\n<h4>2) \u5c0f\u5beb <span style=\"color: #ff0000;\">lower ( )<\/span><\/h4>\n<pre class=\"lang:python\">a = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(a.lower())<\/pre>\n<pre class=\"lang:python\">hello, oceane!<\/pre>\n<p># \u5c07 print (a) \u518d\u52a0\u4e0a <span style=\"color: #ff0000;\">lower ()<\/span> \uff0c\u5247\u7d50\u679c\u6703\u8b93\u6240\u6709 Strings \u88e1\u9762\u7684\u5b57\u6bcd\u8b8a\u6210<span style=\"color: #ff0000;\">\u5c0f\u5beb<\/span>\u3002<\/p>\n<h4>3) \u522a\u9664 Strings \u524d\u5f8c\u7a7a\u683c <span style=\"color: #ff0000;\">strip&nbsp;( )<\/span><\/h4>\n<pre class=\"lang:python\">a = \" Hello, Oceane! \"<\/pre>\n<pre class=\"lang:python\">print(a.strip())<\/pre>\n<pre class=\"lang:python\">Hello, Oceane!<\/pre>\n<p># \u5c07 print (a) \u518d\u52a0\u4e0a <span style=\"color: #ff0000;\">strip ()<\/span> \uff0c\u5247\u7d50\u679c\u6703\u8b93 Strings\uff08 Hello, Oceane! \uff09<span style=\"color: #ff0000;\">\u6700\u524d\u9762<\/span>\u548c<span style=\"color: #ff0000;\">\u6700\u5f8c\u9762<\/span>\u7684\u7a7a\u683c\u88ab\u522a\u9664\u3002<\/p>\n<h4>4) \u66ff\u63db\u5b57\u6bcd <span style=\"color: #ff0000;\">replace ( )<\/span><\/h4>\n<pre class=\"lang:python\">a = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(a.replace(\"H\", \"A\"))<\/pre>\n<pre>Aello, Oceane! <\/pre>\n<p># \u5c07 print (a) \u518d\u52a0\u4e0a <span style=\"color: #ff0000;\">replace ( &#8220;H&#8221;, &#8220;A&#8221; )<\/span> \uff0c\u5247\u7d50\u679c\u6703\u8b93 Strings \u4e2d\u7684 <span style=\"color: #ff0000;\">H <\/span>\u88ab <span style=\"color: #ff0000;\">A <\/span>\u66ff\u63db\uff0c\u800c\u5f9e <span style=\"color: #ff0000;\">H<\/span>ello \u8b8a\u6210 <span style=\"color: #ff0000;\">A<\/span>ello\u3002<\/p>\n<h4>5) \u5206\u5272\u5b57\u4e32 <span style=\"color: #ff0000;\">split ( )<\/span><\/h4>\n<pre class=\"lang:python\">a = \"Hello, Oceane!\"<\/pre>\n<pre class=\"lang:python\">print(a.split(\",\"))<\/pre>\n<pre class=\"lang:python\">['Hello', ' Oceane!']<\/pre>\n<p># \u5c07 print (a) \u518d\u52a0\u4e0a <span style=\"color: #ff0000;\">split ( &#8221; , &#8221; )<\/span> \uff0c\u5247\u5c07 Strings \u4e2d<span style=\"color: #ff0000;\">\u9017\u9ede\u524d\u5f8c<\/span>\u7684\u5169\u500b\u5b57\u88ab\u5206\u5272\u6210\uff1a<span style=\"color: #ff0000;\">Hello <\/span>\u548c&nbsp;<span style=\"color: #ff0000;\">Oceane <\/span>\u3002<\/p>\n\n\n<p><\/p>\n\n\n<h3>\u00a0<\/h3>\n<h3>9. String concatenation \u4e32\u806f\u5b57\u4e32\uff1a\u5229\u7528\u52a0\u865f <span style=\"color: #ff0000;\">+ <\/span>\u8868\u793a<a id=\"concatenation\"><\/a><\/h3>\n<pre class=\"lang:python\">a = \"Hello\"<br \/>b = \"Oceane!\"<br \/>c = a + b<br \/>print(c)<\/pre>\n<pre class=\"lang:python\">HelloOceane!<\/pre>\n<p># \u5229\u7528\u52a0\u865f\uff08 <strong><span style=\"color: #ff0000;\">+<\/span><\/strong> \uff09\u5c07 a \u3001 b \u5b57\u4e32\u76f8\u52a0\u6210 c\u3002<\/p>\n<p>\u53c8\u6216\u8005<\/p>\n<pre class=\"lang:python\">a = \"Hello\"<br \/>b = \", \"<br \/>c = \"Oceane!\"<br \/>d = a + b + c<br \/>print(d)<\/pre>\n<pre class=\"lang:python\">Hello, Oceane!<\/pre>\n<p># \u5229\u7528\u52a0\u865f\uff08 <strong><span style=\"color: #ff0000;\">+<\/span><\/strong> \uff09\u5c07 a \u3001 b \u3001 c\u00a0 \u5b57\u4e32\u76f8\u52a0\u6210 d\u3002<\/p>\n<pre class=\"lang:python\">a = \"Hello\"<br \/>b = \"Oceane!\"<br \/>c = a + \" \" + b<br \/>print(c)<\/pre>\n<pre class=\"lang:python\">Hello Oceane!<\/pre>\n<p># \u7576 a\u00a0 <strong><span style=\"color: #ff0000;\">+<\/span><\/strong> <span style=\"color: #0000ff;\">&#8221; &#8221; \uff08\u96d9\u5f15\u865f\uff09<\/span> <strong><span style=\"color: #ff0000;\">+<\/span><\/strong>\u00a0 b \uff0c\u96d9\u5f15\u865f\u4ee3\u8868\u5728 a \u548c b\u5b57\u4e32\u4e4b\u9593\u52a0\u5165\u7a7a\u767d\u3002<\/p>\n<p>\u00a0<\/p>\n<h3>10. String Format \u5b57\u4e32\u683c\u5f0f\uff1a\u5229\u7528<span style=\"color: #ff0000;\"> format ()<\/span> \u5c07<span style=\"color: #ff0000;\">\u5b57\u4e32<\/span>\u548c<span style=\"color: #ff0000;\">\u6578\u5b57<\/span>\u7d50\u5408<a id=\"format\"><\/a><\/h3>\n<p>\u4e00\u822c\u4f86\u8aaa\uff0c\u5b57\u4e32 strings \u548c\u6578\u5b57 numbers \u662f\u7121\u6cd5\u4e32\u5728\u4e00\u8d77\u5448\u73fe\u7684\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:python\">age = 2\ntxt = \"My name is Oceane, I am \" + age\nprint(txt)<\/pre>\n<pre class=\"lang:python\">---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n&lt;ipython-input-155-293f1987e799&gt; in &lt;module&gt;\n      1 age = 2\n----&gt; 2 txt = \"My name is Oceane, I am \" + age\n      3 print(txt)\n\nTypeError: must be str, not int<\/pre>\n<p># \u5b57\u4e32\u548c\u6578\u5b57\u4e32\u806f\uff0c\u5247\u51fa\u73fe Error\u3002<\/p>\n<p>\u53ef\u5229\u7528 <span style=\"color: #ff0000;\">format ()<\/span>\uff0c\u5728 strings \u4e2d<span style=\"color: #ff0000;\">\u60f3\u52a0\u5165\u6578\u5b57\u90e8\u5206<\/span>\u52a0\u5165<span style=\"color: #ff0000;\">\u5927\u62ec\u5f27<\/span>\uff08 <span style=\"color: #ff0000;\">{ }<\/span> \uff09<\/p>\n<pre class=\"lang:python\">age = 2\ntxt = \"My name is Oceane, I am {}\"\nprint(txt.format(age))<\/pre>\n<pre class=\"lang:python\">My name is Oceane, I am 2<\/pre>\n<p># \u5229\u7528 <span style=\"color: #ff0000;\">format ( age )<\/span>\uff0c\u5247\u5728 strings \u4e2d \u5e36\u5165 <span style=\"color: #ff0000;\">age \u7684\u6578\u503c<\/span>\u81f3 <span style=\"color: #ff0000;\">\u5927\u62ec\u5f27<\/span>\uff08 <span style=\"color: #ff0000;\">{ }<\/span> \uff09\u5167\u3002<\/p>\n<p>\u53c8\u6216\u8005 <span style=\"color: #ff0000;\">format ( ) <span style=\"color: #000000;\">\u4e2d\u7684<\/span>\u53c3\u6578\u6578\u91cf\u6c92\u6709\u9650\u5236<\/span><\/p>\n<pre class=\"lang:python\">age = 2\nheight = 100 weight = 8.9\ninfo = \"Oceane is {} years old, {} cm and {} kg.\"\nprint(info.format(age, height, weight))<\/pre>\n<pre class=\"lang:python\">Oceane is 2 years old, 100 cm and 8.9 kg.<\/pre>\n<p># <span style=\"color: #ff0000;\">format ( age, height, weight )<\/span>\uff0c\u5728 strings \u4e2d<span style=\"color: #ff0000;\">\u4f9d\u5e8f<\/span>\u5e36\u5165 <span style=\"color: #ff0000;\">\u5927\u62ec\u5f27<\/span>\uff08 <span style=\"color: #ff0000;\">{ }<\/span> \uff09\u5167\uff0c\u5247\u5448\u73fe { 2 } \u3001{ 100 ]\u3001{ 8.9 }\u3002<\/p>\n<p>\u53c8\u6216\u8005<span style=\"color: #ff0000;\"><span style=\"color: #000000;\">\u5728<\/span>\u5927\u62ec\u5f27 { } <span style=\"color: #000000;\">\u4e2d\u52a0\u5165<\/span>\u4f4d\u7f6e\u7de8\u865f<\/span><\/p>\n<pre class=\"lang:python\">age = 2\nheight = 100\nweight = 8.9\ninfo = \"Oceane is {2} years old, {1} cm and {0} kg.\"\nprint(info.format(weight, height, age))<\/pre>\n<pre class=\"lang:python\">Oceane is 2 years old, 100 cm and 8.9 kg.<\/pre>\n<p># <span style=\"color: #000000;\">\u5982\u5927\u62ec\u5f27\u4f9d\u5e8f\u70ba<br \/><\/span>\u4f4d\u7f6e <span style=\"color: #ff0000;\">2<\/span> <span style=\"color: #ff0000;\"><span style=\"color: #000000;\">{ <span style=\"color: #ff0000;\">2<\/span> }\uff1aage = <span style=\"color: #0000ff;\">2<\/span><br \/>\u4f4d\u7f6e <span style=\"color: #ff0000;\">1<\/span>\u00a0{ <span style=\"color: #ff0000;\">1<\/span> }\uff1aheight = <span style=\"color: #0000ff;\">100<br \/><\/span><\/span><\/span><span style=\"color: #ff0000;\"><span style=\"color: #000000;\">\u4f4d\u7f6e <span style=\"color: #ff0000;\">0<\/span>\u00a0{ <span style=\"color: #ff0000;\">0<\/span> }\uff1aweight = <span style=\"color: #0000ff;\">8.9<br \/><\/span><\/span><\/span>\u5247\u5448\u73fe { <span style=\"color: #0000ff;\">2<\/span> } \u3001{ <span style=\"color: #0000ff;\">100<\/span> }\u3001{ <span style=\"color: #0000ff;\">8.9<\/span> }\u3002<\/p>\n<p>\u00a0<\/p>\n\n\n<p>\u53e6\u4e00\u7bc7<strong>Python Data Types \u8cc7\u6599\u985e\u578b<\/strong>\uff0c\u8acb\u53c3\u8003\uff1a<a href=\"https:\/\/myoceane.fr\/index.php\/python-data-types\/\">https:\/\/myoceane.fr\/index.php\/python-data-types\/<\/a><br>\u53c3\u8003\u51fa\u8655\uff1a<a href=\"https:\/\/www.w3schools.com\/python\/python_strings.asp\">https:\/\/www.w3schools.com\/python\/python_strings.asp<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Data Types \u8cc7\u6599\u985e\u578b &#8211; Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0( )\u00a0\uff09<\/p>\n","protected":false},"author":3,"featured_media":7301,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,176],"tags":[1145,1150,1152,1151,1154,1153,1148,1147,1157,1149,1155,19,1159,1146,1160,1141,1158,1156,1142],"class_list":["post-7194","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it-technology","category-python","tag-array","tag-concatenation","tag-for","tag-format","tag-in","tag-len","tag-length","tag-looping","tag-lower","tag-modify","tag-not-in","tag-python","tag-replace","tag-slicing","tag-split","tag-strings","tag-strip","tag-upper","tag-1142"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane<\/title>\n<meta name=\"description\" content=\"Python Data Types \u8cc7\u6599\u985e\u578b - Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0( )\u00a0\uff09\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/myoceane.fr\/index.php\/python-strings\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\" \/>\n<meta property=\"og:description\" content=\"Python Data Types \u8cc7\u6599\u985e\u578b - Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0( )\u00a0\uff09\" \/>\n<meta property=\"og:url\" content=\"https:\/\/myoceane.fr\/index.php\/python-strings\/\" \/>\n<meta property=\"og:site_name\" content=\"\u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-03T06:11:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-19T01:57:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"\u6ab8\u6aac\u5abd\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6ab8\u6aac\u5abd\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/\"},\"author\":{\"name\":\"\u6ab8\u6aac\u5abd\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3\"},\"headline\":\"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5\",\"datePublished\":\"2021-03-03T06:11:05+00:00\",\"dateModified\":\"2021-03-19T01:57:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/\"},\"wordCount\":258,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\"},\"image\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg\",\"keywords\":[\"array\",\"concatenation\",\"for\",\"format\",\"in\",\"len\",\"length\",\"looping\",\"lower\",\"modify\",\"not in\",\"Python\",\"replace\",\"slicing\",\"split\",\"strings\",\"strip\",\"upper\",\"\u5b57\u4e32\"],\"articleSection\":[\"IT Technology\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/myoceane.fr\/index.php\/python-strings\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/\",\"url\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/\",\"name\":\"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\",\"isPartOf\":{\"@id\":\"https:\/\/myoceane.fr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg\",\"datePublished\":\"2021-03-03T06:11:05+00:00\",\"dateModified\":\"2021-03-19T01:57:06+00:00\",\"description\":\"Python Data Types \u8cc7\u6599\u985e\u578b - Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0( )\u00a0\uff09\",\"breadcrumb\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/myoceane.fr\/index.php\/python-strings\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage\",\"url\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg\",\"contentUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg\",\"width\":1200,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-strings\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/myoceane.fr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/myoceane.fr\/#website\",\"url\":\"https:\/\/myoceane.fr\/\",\"name\":\"M-Y-Oceane \u60f3\u65b9\u6d89\u6cd5\u3002\u91cf\u74f6\u5916\u7684\u5929\u7a7a\",\"description\":\"\u60f3\u65b9\u6d89\u6cd5, France, Taiwan, Health, Information Technology\",\"publisher\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/myoceane.fr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\",\"name\":\"\u6ab8\u6aac\u7238\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g\",\"caption\":\"\u6ab8\u6aac\u7238\"},\"logo\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3\",\"name\":\"\u6ab8\u6aac\u5abd\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g\",\"caption\":\"\u6ab8\u6aac\u5abd\"},\"url\":\"https:\/\/myoceane.fr\/index.php\/author\/anataliechougmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","description":"Python Data Types \u8cc7\u6599\u985e\u578b - Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0( )\u00a0\uff09","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/myoceane.fr\/index.php\/python-strings\/","og_locale":"en_US","og_type":"article","og_title":"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","og_description":"Python Data Types \u8cc7\u6599\u985e\u578b - Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0( )\u00a0\uff09","og_url":"https:\/\/myoceane.fr\/index.php\/python-strings\/","og_site_name":"\u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","article_published_time":"2021-03-03T06:11:05+00:00","article_modified_time":"2021-03-19T01:57:06+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg","type":"image\/jpeg"}],"author":"\u6ab8\u6aac\u5abd","twitter_card":"summary_large_image","twitter_misc":{"Written by":"\u6ab8\u6aac\u5abd","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/#article","isPartOf":{"@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/"},"author":{"name":"\u6ab8\u6aac\u5abd","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3"},"headline":"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5","datePublished":"2021-03-03T06:11:05+00:00","dateModified":"2021-03-19T01:57:06+00:00","mainEntityOfPage":{"@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/"},"wordCount":258,"commentCount":1,"publisher":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b"},"image":{"@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage"},"thumbnailUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg","keywords":["array","concatenation","for","format","in","len","length","looping","lower","modify","not in","Python","replace","slicing","split","strings","strip","upper","\u5b57\u4e32"],"articleSection":["IT Technology","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/myoceane.fr\/index.php\/python-strings\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/","url":"https:\/\/myoceane.fr\/index.php\/python-strings\/","name":"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","isPartOf":{"@id":"https:\/\/myoceane.fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage"},"image":{"@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage"},"thumbnailUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg","datePublished":"2021-03-03T06:11:05+00:00","dateModified":"2021-03-19T01:57:06+00:00","description":"Python Data Types \u8cc7\u6599\u985e\u578b - Strings \u5b57\u4e32\uff1a\u5229\u7528\u5c0f\u62ec\u865f\uff08\u00a0( )\u00a0\uff09","breadcrumb":{"@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/myoceane.fr\/index.php\/python-strings\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/#primaryimage","url":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg","contentUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Strings.jpg","width":1200,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/myoceane.fr\/index.php\/python-strings\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/myoceane.fr\/"},{"@type":"ListItem","position":2,"name":"[Python\u521d\u5b78\u8005] 10\u7a2e Strings \u5b57\u4e32\u7528\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/myoceane.fr\/#website","url":"https:\/\/myoceane.fr\/","name":"M-Y-Oceane \u60f3\u65b9\u6d89\u6cd5\u3002\u91cf\u74f6\u5916\u7684\u5929\u7a7a","description":"\u60f3\u65b9\u6d89\u6cd5, France, Taiwan, Health, Information Technology","publisher":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/myoceane.fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b","name":"\u6ab8\u6aac\u7238","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g","caption":"\u6ab8\u6aac\u7238"},"logo":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3","name":"\u6ab8\u6aac\u5abd","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g","caption":"\u6ab8\u6aac\u5abd"},"url":"https:\/\/myoceane.fr\/index.php\/author\/anataliechougmail-com\/"}]}},"amp_enabled":false,"_links":{"self":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/7194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/comments?post=7194"}],"version-history":[{"count":98,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/7194\/revisions"}],"predecessor-version":[{"id":7420,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/7194\/revisions\/7420"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/media\/7301"}],"wp:attachment":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/media?parent=7194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/categories?post=7194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/tags?post=7194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}