{"id":205144,"date":"2025-05-29T08:54:37","date_gmt":"2025-05-29T00:54:37","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205144\/"},"modified":"2025-05-29T08:54:37","modified_gmt":"2025-05-29T00:54:37","slug":"python-%e7%ac%ac-00-%e5%a4%a9","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205144\/","title":{"rendered":"Python \u7b2c 00 \u5929"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python \u7b2c 00 \u5929<\/h1>\n<p>\u672c\u7bc7\u6587\u7ae0\u5411\u5927\u5bb6\u4ecb\u7ecd\u300aPython \u7b2c 00 \u5929\u300b\uff0c\u4e3b\u8981\u5305\u62ec\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241124\/17324429846742fb68283c8.jpg\" class=\"aligncenter\"><\/p>\n<p>\u4eca\u5929\uff0c\u6211\u5f00\u59cb\u4e86\u6211\u7684\u4e2a\u4eba\u6311\u6218#100DaysOfCode\u3002\u4e3a\u4e86\u8fd9\u4e2a\u6311\u6218\uff0c\u6211\u9009\u62e9\u5b66\u4e60Python\uff0c\u56e0\u4e3a\u6211\u7684\u76ee\u6807\u662f\u6210\u4e3a\u4e00\u540d\u6570\u636e\u5206\u6790\u5e08\u3002<\/p>\n<p><strong>\u7b2c 2 \u7ae0\uff1a<\/strong> \u53d8\u91cf\u548c\u5b57\u7b26\u4e32 <br \/> \u6211\u7528\u6765\u5b66\u4e60 Python \u7684\u6750\u6599\u662f Eric Matthes \u5199\u7684\u4e00\u672c\u540d\u4e3a\u300aPython Crash Course\u300b\u7684\u4e66\u3002\u5b83\u5bf9\u5b66\u4e60\u975e\u5e38\u6709\u5e2e\u52a9\uff0c\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u6211\u6ce8\u610f\u5230\u5b83\u7528\u7b80\u5355\u7684\u8bed\u8a00\u89e3\u91ca\u4e86\u6982\u5ff5\u3002\u4eca\u5929\uff0c\u6211\u5b66\u4e60\u4e86<em>\u53d8\u91cf\u548c\u5b57\u7b26\u4e32<\/em>\u3002 <\/p>\n<p><strong>\u4ee3\u7801<\/strong><\/p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u53d8\u91cf `\u56fd\u5bb6=\u201c\u54c8\u8428\u514b\u65af\u5766\u201d \u6253\u5370\uff08\u56fd\u5bb6\uff09<\/li>\n<\/ol>\n<p>\u56fd\u5bb6=\u201c\u4fc4\u7f57\u65af\u201d<br \/> \u6253\u5370\uff08\u56fd\u5bb6\uff09`<\/p>\n<ol>\n<li>\n<p>\u5b66\u4e60\u4e00\u4e2a\u65b0\u51fd\u6570 title()<br \/> \u540d\u79f0 =\u201cada lovelace\u201d<br \/> print(name.title())<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528 f \u5b57\u7b26\u4e32\u5b8c\u6210\u6d88\u606f<br \/> \u540d\u5b57 =\u201cada\u201d<br \/> \u59d3\u6c0f=\u201clovelace\u201d<br \/> full_name =f&#8221;{first_name} {last_name}&#8221;<br \/> print(f&#8221;\u4f60\u597d\uff0c{full_name.title()}\uff01&#8221;)<\/p>\n<\/li>\n<\/ol>\n<p>4.\u5bf9\u6211\u6765\u8bf4\u65b0\u4e8b\u7269\uff1a\u5b66\u4e60nt\uff08\u6362\u884c\u7b26\u548c\u5236\u8868\u7b26\uff09<br \/> 5.\u5728\u8fd9\u6837\u7684\u4ee3\u7801\u540e\u9762\u5199\u65f6\u4e0d\u8981\u5fd8\u8bb0\u4f7f\u7528 ()<br \/> \u540d\u79f0 =\u201czhanel\u201d<br \/> print(name.lower())<br \/> print(name.upper())<br \/> print(name.title())<\/p>\n<p><strong>\u660e\u5929<\/strong><br \/> \u660e\u5929\u5468\u4e94\u53ef\u80fd\u5f88\u96be\u82b11\u4e2a\u5c0f\u65f6\uff0c\u4f46\u6211\u4f1a\u52aa\u529b\u5b8c\u6210\u7b2c\u4e8c\u7ae0\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aPython \u7b2c 00 \u5929\u300b\u7684\u5185\u5bb9\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\uff0c\u5982\u679c\u6709\u4ec0\u4e48\u7591\u95ee\u6216\u8005\u5efa\u8bae\uff0c\u53ef\u4ee5\u5728\u516c\u4f17\u53f7\u4e0b\u591a\u591a\u56de\u590d\u4ea4\u6d41\uff1b\u6587\u4e2d\u82e5\u6709\u4e0d\u6b63\u4e4b\u5904\uff0c\u4e5f\u5e0c\u671b\u56de\u590d\u7559\u8a00\u4ee5\u544a\u77e5\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u7b2c 00 \u5929 \u672c\u7bc7&#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-205144","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205144","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=205144"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205144\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}