\n\n\u5e8f\u53f7<\/td>\n | \u65b9\u6cd5\u53ca\u63cf\u8ff0<\/td>\n<\/tr>\n |
\n1<\/td>\n | capitalize() \u5c06\u5b57\u7b26\u4e32\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\u8f6c\u6362\u4e3a\u5927\u5199<\/td>\n<\/tr>\n |
\n2<\/td>\n | center(width, fillchar) \u8fd4\u56de\u4e00\u4e2a\u6307\u5b9a\u7684\u5bbd\u5ea6 width \u5c45\u4e2d\u7684\u5b57\u7b26\u4e32\uff0cfillchar \u4e3a\u586b\u5145\u7684\u5b57\u7b26\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u683c\u3002<\/td>\n<\/tr>\n |
\n3<\/td>\n | count(str, beg= 0,end=len(string)) \u8fd4\u56de str \u5728 string \u91cc\u9762\u51fa\u73b0\u7684\u6b21\u6570\uff0c\u5982\u679c beg \u6216\u8005 end \u6307\u5b9a\u5219\u8fd4\u56de\u6307\u5b9a\u8303\u56f4\u5185 str \u51fa\u73b0\u7684\u6b21\u6570<\/td>\n<\/tr>\n |
\n4<\/td>\n | bytes.decode(encoding=\"utf-8\", errors=\"strict\") Python3 \u4e2d\u6ca1\u6709 decode \u65b9\u6cd5\uff0c\u4f46\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 bytes \u5bf9\u8c61\u7684 decode() \u65b9\u6cd5\u6765\u89e3\u7801\u7ed9\u5b9a\u7684 bytes \u5bf9\u8c61\uff0c\u8fd9\u4e2a bytes \u5bf9\u8c61\u53ef\u4ee5\u7531 str.encode() \u6765\u7f16\u7801\u8fd4\u56de\u3002<\/td>\n<\/tr>\n |
\n5<\/td>\n | encode(encoding='UTF-8',errors='strict') \u4ee5 encoding \u6307\u5b9a\u7684\u7f16\u7801\u683c\u5f0f\u7f16\u7801\u5b57\u7b26\u4e32\uff0c\u5982\u679c\u51fa\u9519\u9ed8\u8ba4\u62a5\u4e00\u4e2aValueError \u7684\u5f02\u5e38\uff0c\u9664\u975e errors \u6307\u5b9a\u7684\u662f'ignore'\u6216\u8005'replace'<\/td>\n<\/tr>\n |
\n6<\/td>\n | endswith(suffix, beg=0, end=len(string)) \u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u4ee5 obj \u7ed3\u675f\uff0c\u5982\u679cbeg \u6216\u8005 end \u6307\u5b9a\u5219\u68c0\u67e5\u6307\u5b9a\u7684\u8303\u56f4\u5185\u662f\u5426\u4ee5 obj \u7ed3\u675f\uff0c\u5982\u679c\u662f\uff0c\u8fd4\u56de True,\u5426\u5219\u8fd4\u56de False.<\/td>\n<\/tr>\n |
\n7<\/td>\n | expandtabs(tabsize=8) \u628a\u5b57\u7b26\u4e32 string \u4e2d\u7684 tab \u7b26\u53f7\u8f6c\u4e3a\u7a7a\u683c\uff0ctab \u7b26\u53f7\u9ed8\u8ba4\u7684\u7a7a\u683c\u6570\u662f 8 \u3002<\/td>\n<\/tr>\n |
\n8<\/td>\n | find(str, beg=0, end=len(string)) \u68c0\u6d4b str \u662f\u5426\u5305\u542b\u5728\u5b57\u7b26\u4e32\u4e2d\uff0c\u5982\u679c\u6307\u5b9a\u8303\u56f4 beg \u548c end \uff0c\u5219\u68c0\u67e5\u662f\u5426\u5305\u542b\u5728\u6307\u5b9a\u8303\u56f4\u5185\uff0c\u5982\u679c\u5305\u542b\u8fd4\u56de\u5f00\u59cb\u7684\u7d22\u5f15\u503c\uff0c\u5426\u5219\u8fd4\u56de-1\u3002<\/td>\n<\/tr>\n |
\n9<\/td>\n | index(str, beg=0, end=len(string)) \u8ddffind()\u65b9\u6cd5\u4e00\u6837\uff0c\u53ea\u4e0d\u8fc7\u5982\u679cstr\u4e0d\u5728\u5b57\u7b26\u4e32\u4e2d\u4f1a\u62a5\u4e00\u4e2a\u5f02\u5e38\u3002<\/td>\n<\/tr>\n |
\n10<\/td>\n | isalnum() \u5982\u679c\u5b57\u7b26\u4e32\u81f3\u5c11\u6709\u4e00\u4e2a\u5b57\u7b26\u5e76\u4e14\u6240\u6709\u5b57\u7b26\u90fd\u662f\u5b57\u6bcd\u6216\u6570\u5b57\u5219\u8fd4 \u56de True,\u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n11<\/td>\n | isalpha() \u5982\u679c\u5b57\u7b26\u4e32\u81f3\u5c11\u6709\u4e00\u4e2a\u5b57\u7b26\u5e76\u4e14\u6240\u6709\u5b57\u7b26\u90fd\u662f\u5b57\u6bcd\u5219\u8fd4\u56de True, \u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n12<\/td>\n | isdigit() \u5982\u679c\u5b57\u7b26\u4e32\u53ea\u5305\u542b\u6570\u5b57\u5219\u8fd4\u56de True \u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n13<\/td>\n | islower() \u5982\u679c\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u81f3\u5c11\u4e00\u4e2a\u533a\u5206\u5927\u5c0f\u5199\u7684\u5b57\u7b26\uff0c\u5e76\u4e14\u6240\u6709\u8fd9\u4e9b(\u533a\u5206\u5927\u5c0f\u5199\u7684)\u5b57\u7b26\u90fd\u662f\u5c0f\u5199\uff0c\u5219\u8fd4\u56de True\uff0c\u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n14<\/td>\n | isnumeric() \u5982\u679c\u5b57\u7b26\u4e32\u4e2d\u53ea\u5305\u542b\u6570\u5b57\u5b57\u7b26\uff0c\u5219\u8fd4\u56de True\uff0c\u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n15<\/td>\n | isspace() \u5982\u679c\u5b57\u7b26\u4e32\u4e2d\u53ea\u5305\u542b\u7a7a\u767d\uff0c\u5219\u8fd4\u56de True\uff0c\u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n16<\/td>\n | istitle() \u5982\u679c\u5b57\u7b26\u4e32\u662f\u6807\u9898\u5316\u7684(\u89c1 title())\u5219\u8fd4\u56de True\uff0c\u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n17<\/td>\n | isupper() \u5982\u679c\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u81f3\u5c11\u4e00\u4e2a\u533a\u5206\u5927\u5c0f\u5199\u7684\u5b57\u7b26\uff0c\u5e76\u4e14\u6240\u6709\u8fd9\u4e9b(\u533a\u5206\u5927\u5c0f\u5199\u7684)\u5b57\u7b26\u90fd\u662f\u5927\u5199\uff0c\u5219\u8fd4\u56de True\uff0c\u5426\u5219\u8fd4\u56de False\u3002<\/td>\n<\/tr>\n |
\n18<\/td>\n | join(seq) \u4ee5\u6307\u5b9a\u5b57\u7b26\u4e32\u4f5c\u4e3a\u5206\u9694\u7b26\uff0c\u5c06 seq \u4e2d\u6240\u6709\u7684\u5143\u7d20(\u7684\u5b57\u7b26\u4e32\u8868\u793a)\u5408\u5e76\u4e3a\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002<\/td>\n<\/tr>\n |
\n19<\/td>\n | len(string) \u8fd4\u56de\u5b57\u7b26\u4e32\u957f\u5ea6\u3002<\/td>\n<\/tr>\n |
\n20<\/td>\n | ljust(width[, fillchar]) \u8fd4\u56de\u4e00\u4e2a\u539f\u5b57\u7b26\u4e32\u5de6\u5bf9\u9f50,\u5e76\u4f7f\u7528 fillchar \u586b\u5145\u81f3\u957f\u5ea6 width \u7684\u65b0\u5b57\u7b26\u4e32\uff0cfillchar \u9ed8\u8ba4\u4e3a\u7a7a\u683c\u3002<\/td>\n<\/tr>\n |
\n21<\/td>\n | lower() \u8f6c\u6362\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5927\u5199\u5b57\u7b26\u4e3a\u5c0f\u5199\u3002<\/td>\n<\/tr>\n |
\n22<\/td>\n | lstrip() \u622a\u6389\u5b57\u7b26\u4e32\u5de6\u8fb9\u7684\u7a7a\u683c\u6216\u6307\u5b9a\u5b57\u7b26\u3002<\/td>\n<\/tr>\n |
\n23<\/td>\n | maketrans() \u521b\u5efa\u5b57\u7b26\u6620\u5c04\u7684\u8f6c\u6362\u8868\uff0c\u5bf9\u4e8e\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\u7684\u6700\u7b80\u5355\u7684\u8c03\u7528\u65b9\u5f0f\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u5b57\u7b26\u4e32\uff0c\u8868\u793a\u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e5f\u662f\u5b57\u7b26\u4e32\u8868\u793a\u8f6c\u6362\u7684\u76ee\u6807\u3002<\/td>\n<\/tr>\n |
\n24<\/td>\n | max(str) \u8fd4\u56de\u5b57\u7b26\u4e32 str \u4e2d\u6700\u5927\u7684\u5b57\u6bcd\u3002<\/td>\n<\/tr>\n |
\n25<\/td>\n | min(str) \u8fd4\u56de\u5b57\u7b26\u4e32 str \u4e2d\u6700\u5c0f\u7684\u5b57\u6bcd\u3002<\/td>\n<\/tr>\n |
\n26 <\/td>\n | replace(old, new [, max]) \u628a \u5c06\u5b57\u7b26\u4e32\u4e2d\u7684 str1 \u66ff\u6362\u6210 str2,\u5982\u679c max \u6307\u5b9a\uff0c\u5219\u66ff\u6362\u4e0d\u8d85\u8fc7 max \u6b21\u3002<\/td>\n<\/tr>\n |
\n27<\/td>\n | rfind(str, beg=0,end=len(string)) \u7c7b\u4f3c\u4e8e find()\u51fd\u6570\uff0c\u4e0d\u8fc7\u662f\u4ece\u53f3\u8fb9\u5f00\u59cb\u67e5\u627e\u3002<\/td>\n<\/tr>\n |
\n28<\/td>\n | rindex( str, beg=0, end=len(string)) \u7c7b\u4f3c\u4e8e index()\uff0c\u4e0d\u8fc7\u662f\u4ece\u53f3\u8fb9\u5f00\u59cb\u3002<\/td>\n<\/tr>\n |
\n29<\/td>\n | rjust(width,[, fillchar]) \u8fd4\u56de\u4e00\u4e2a\u539f\u5b57\u7b26\u4e32\u53f3\u5bf9\u9f50,\u5e76\u4f7f\u7528fillchar(\u9ed8\u8ba4\u7a7a\u683c\uff09\u586b\u5145\u81f3\u957f\u5ea6 width \u7684\u65b0\u5b57\u7b26\u4e32\u3002<\/td>\n<\/tr>\n |
\n30<\/td>\n | rstrip() \u5220\u9664\u5b57\u7b26\u4e32\u5b57\u7b26\u4e32\u672b\u5c3e\u7684\u7a7a\u683c\u3002<\/td>\n<\/tr>\n |
\n31<\/td>\n | split(str=\"\", num=string.count(str)) num=string.count(str)) \u4ee5 str \u4e3a\u5206\u9694\u7b26\u622a\u53d6\u5b57\u7b26\u4e32\uff0c\u5982\u679c num \u6709\u6307\u5b9a\u503c\uff0c\u5219\u4ec5\u622a\u53d6 num+1 \u4e2a\u5b50\u5b57\u7b26\u4e32\u3002<\/td>\n<\/tr>\n |
\n32<\/td>\n | splitlines([keepends]) \u6309\u7167\u884c('\\r', '\\r\\n', \\n')\u5206\u9694\uff0c\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u5404\u884c\u4f5c\u4e3a\u5143\u7d20\u7684\u5217\u8868\uff0c\u5982\u679c\u53c2\u6570 keepends \u4e3a False\uff0c\u4e0d\u5305\u542b\u6362\u884c\u7b26\uff0c\u5982\u679c\u4e3a True\uff0c\u5219\u4fdd\u7559\u6362\u884c\u7b26\u3002<\/td>\n<\/tr>\n |
\n33<\/td>\n | startswith(substr, beg=0,end=len(string)) \u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u662f\u4ee5\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32 substr \u5f00\u5934\uff0c\u662f\u5219\u8fd4\u56de True\uff0c\u5426\u5219\u8fd4\u56de False\u3002\u5982\u679cbeg \u548c end \u6307\u5b9a\u503c\uff0c\u5219\u5728\u6307\u5b9a\u8303\u56f4\u5185\u68c0\u67e5\u3002<\/td>\n<\/tr>\n |
\n34<\/td>\n | strip([chars]) \u5728\u5b57\u7b26\u4e32\u4e0a\u6267\u884c lstrip()\u548c rstrip()\u3002<\/td>\n<\/tr>\n |
\n35<\/td>\n | swapcase() \u5c06\u5b57\u7b26\u4e32\u4e2d\u5927\u5199\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u5c0f\u5199\u8f6c\u6362\u4e3a\u5927\u5199\u3002<\/td>\n<\/tr>\n |
\n36<\/td>\n | title() \u8fd4\u56de\"\u6807\u9898\u5316\"\u7684\u5b57\u7b26\u4e32,\u5c31\u662f\u8bf4\u6240\u6709\u5355\u8bcd\u90fd\u662f\u4ee5\u5927\u5199\u5f00\u59cb\uff0c\u5176\u4f59\u5b57\u6bcd\u5747\u4e3a\u5c0f\u5199(\u89c1 istitle())\u3002<\/td>\n<\/tr>\n |
\n37<\/td>\n | translate(table, deletechars=\"\") \u6839\u636e str \u7ed9\u51fa\u7684\u8868(\u5305\u542b 256 \u4e2a\u5b57\u7b26)\u8f6c\u6362 string \u7684\u5b57\u7b26, \u8981\u8fc7\u6ee4\u6389\u7684\u5b57\u7b26\u653e\u5230 deletechars \u53c2\u6570\u4e2d\u3002<\/td>\n<\/tr>\n |
\n38<\/td>\n | upper() \u8f6c\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u5c0f\u5199\u5b57\u6bcd\u4e3a\u5927\u5199\u3002<\/td>\n<\/tr>\n |
\n39<\/td>\n | zfill(width) \u8fd4\u56de\u957f\u5ea6\u4e3a width \u7684\u5b57\u7b26\u4e32\uff0c\u539f\u5b57\u7b26\u4e32\u53f3\u5bf9\u9f50\uff0c\u524d\u9762\u586b\u51450\u3002<\/td>\n<\/tr>\n |
\n40<\/td>\n | isdecimal() \u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u53ea\u5305\u542b\u5341\u8fdb\u5236\u5b57\u7b26\uff0c\u5982\u679c\u662f\u8fd4\u56de true\uff0c\u5426\u5219\u8fd4\u56de false\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/body> \n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"Python \u5b57\u7b26\u4e32zh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[126],"tags":[],"class_list":["post-1022","post","type-post","status-publish","format-standard","hentry","category-python3"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1022"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1022"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1022\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |