{"id":205368,"date":"2025-05-29T11:04:38","date_gmt":"2025-05-29T03:04:38","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205368\/"},"modified":"2025-05-29T11:04:38","modified_gmt":"2025-05-29T03:04:38","slug":"python-%e4%b8%ad-isupper-%e5%92%8c-islower-%e6%96%b9%e6%b3%95%e7%9a%84%e6%8b%ac%e5%8f%b7%e4%b8%ba%e4%bb%80%e4%b9%88%e6%9c%89%e6%97%b6%e5%8f%af%e4%bb%a5%e7%9c%81%e7%95%a5%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205368\/","title":{"rendered":"Python \u4e2d .isupper() \u548c .islower() \u65b9\u6cd5\u7684\u62ec\u53f7\u4e3a\u4ec0\u4e48\u6709\u65f6\u53ef\u4ee5\u7701\u7565\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python \u4e2d .isupper() \u548c .islower() \u65b9\u6cd5\u7684\u62ec\u53f7\u4e3a\u4ec0\u4e48\u6709\u65f6\u53ef\u4ee5\u7701\u7565\uff1f<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u5c31\u6574\u7406\u5206\u4eab\u300aPython \u4e2d .isupper() \u548c .islower() \u65b9\u6cd5\u7684\u62ec\u53f7\u4e3a\u4ec0\u4e48\u6709\u65f6\u53ef\u4ee5\u7701\u7565\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241130\/1732926650674a5cbae296e.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u5b57\u7b26\u4e32\u65b9\u6cd5.isupper()\u548c.islower()\u7684\u62ec\u53f7\u4f5c\u7528<\/strong><\/p>\n<p>\u5728python\u4e2d\uff0c.isupper()\u548c.islower()\u65b9\u6cd5\u53ef\u4ee5\u68c0\u67e5\u5b57\u7b26\u4e32\u4e2d\u5b57\u7b26\u662f\u5426\u4e3a\u5927\u5199\u6216\u5c0f\u5199\u5b57\u6bcd\u3002\u5c3d\u7ba1\u5982\u6b64\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u4e0d\u5e26\u62ec\u53f7\u4e5f\u80fd\u8fd0\u884c\uff0c\u4ee4\u4eba\u56f0\u60d1\u3002<\/p>\n<p><strong>\u65b9\u6cd5\u4f5c\u4e3a\u5c5e\u6027<\/strong><\/p>\n<p>\u5728python\u4e2d\uff0c\u65b9\u6cd5\u53ef\u4ee5\u89c6\u4e3a\u5c5e\u6027\uff0c\u65e0\u9700\u62ec\u53f7\u5373\u53ef\u76f4\u63a5\u8bbf\u95ee\u3002\u56e0\u6b64\uff0c\u4f60\u53ef\u4ee5\u8fd9\u6837\u5199\uff1a<\/p>\n<pre>if i.islower:\n    # \u6267\u884c\u64cd\u4f5c<\/pre>\n<p>\u6216\u8005\uff1a<\/p>\n<pre>if i.isupper:\n    # \u6267\u884c\u64cd\u4f5c<\/pre>\n<p>\u8fd9\u4e24\u79cd\u5199\u6cd5\u4e0e\u5e26\u62ec\u53f7\u7684\u5199\u6cd5\u76f8\u540c\u3002<\/p>\n<p><strong>\u4ee3\u7801\u4e2d\u7684\u73b0\u8c61<\/strong><\/p>\n<p>\u5728\u4f60\u7684\u4ee3\u7801\u4e2d\uff0c\u5220\u9664\u62ec\u53f7\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u8f93\u51fa\u7ed3\u679c\u3002\u8fd9\u662f\u56e0\u4e3a\u4f60\u7684\u4ee3\u7801\u5728\u68c0\u67e5.islower\u6216.isupper\u65b9\u6cd5\u662f\u5426\u5b58\u5728\uff0c\u800c\u4e0d\u662f\u8c03\u7528\u5b83\u4eec\u3002\u7531\u4e8e\u8fd9\u4e9b\u65b9\u6cd5\u5b58\u5728\uff0c\u6761\u4ef6\u59cb\u7ec8\u4e3a\u771f\uff0c\u5bfc\u81f4\u4e86\u4e0d\u540c\u7684\u8f93\u51fa\u3002<\/p>\n<p><strong>\u62ec\u53f7\u7684\u4f5c\u7528<\/strong><\/p>\n<p>\u62ec\u53f7\u5728\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\u7684\u4f5c\u7528\u662f\u8c03\u7528\u65b9\u6cd5\uff0c\u800c\u4e0d\u662f\u68c0\u67e5\u5176\u662f\u5426\u5b58\u5728\u3002\u4e0d\u4f7f\u7528\u62ec\u53f7\uff0c\u6761\u4ef6\u5c06\u68c0\u67e5\u65b9\u6cd5\u7684\u5b58\u5728\u6027\uff0c\u800c\u4f7f\u7528\u62ec\u53f7\u5219\u4f1a\u8c03\u7528\u5b83\u4eec\u5e76\u6267\u884c\u903b\u8f91\u3002<\/p>\n<p>\u4eca\u5929\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff1b\u5173\u4e8e\u6587\u7ae0\u7684\u6280\u672f\u77e5\u8bc6\u6211\u4eec\u4f1a\u4e00\u70b9\u70b9\u6df1\u5165\u4ecb\u7ecd\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u4e00\u8d77\u5b66\u4e60\u7f16\u7a0b~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u4e2d .isuppe&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-205368","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=205368"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205368\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}