{"id":93533,"date":"2020-04-08T07:28:08","date_gmt":"2020-04-07T23:28:08","guid":{"rendered":"http:\/\/4563.org\/?p=93533"},"modified":"2020-04-08T07:28:08","modified_gmt":"2020-04-07T23:28:08","slug":"python-%e5%ad%a6%e4%b9%a0%e4%b9%8b%e7%9c%8b%e4%b9%a6%e5%81%9a%e9%a2%98%e6%9c%89%e6%84%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=93533","title":{"rendered":"Python \u5b66\u4e60\u4e4b\u770b\u4e66\u505a\u9898\u6709\u611f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python \u5b66\u4e60\u4e4b\u770b\u4e66\u505a\u9898\u6709\u611f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jeblur <\/span>  <span><i><\/i> 22<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6700\u8fd1\u4e00\u76f4\u6c89\u8ff7\u4e8e python \u7684\u5b66\u4e60\uff0c\u770b\u4e86 B \u7684\u67d0\u4e00\u8bb2\u89e3\u5b9e\u4f8b\u7684\u89c6\u9891\u5176\u4e2d\u63a8\u8350\u4e86\u4e00\u672c\u4e66\u300a Python Crash Course \u300b\uff0c\u53d1\u73b0\u4e86\u8fd9\u672c\u4e66\u5b58\u5728\u7684\u4e00\u4e2a\u95ee\u9898\uff1a<\/p>\n<p> \u6ca1\u6709\u63d0\u524d\u8bb2\u89e3\u503c\u7684\u7c7b\u578b\uff0c\u5728\u505a\u7ec3\u4e60\u7684\u65f6\u5019\u7ecf\u5e38\u80fd\u770b\u5230\u5404\u79cd\u6570\u503c\u9519\u8bef\uff0c\u6bd4\u5982\u5217\u8868\u4e2d\u7684\u6570\u5b57\u4e0d\u80fd\u76f4\u63a5\u5224\u65ad\uff0c\u9700\u8981\u5c06\u4f7f\u7528 int \u8f6c\u5316\u4e3a\u6570\u3002<\/p>\n<p> \u4eca\u5929\u53c8\u78b0\u5230\u4e00\u4e2a\u95ee\u9898\uff0c\u53d1\u73b0\u6ca1\u6cd5\u5728 for \u5faa\u73af\u4e2d\u5224\u65ad\u4e00\u4e2a\u503c\u662f\u5426\u5728\u5217\u8868\u4e2d\uff1a<\/p>\n<pre><code>usernames = ['admin', 'adobe', 'excel', 'word', 'vscode']  for username in usernames:     if username == admin:         print(f\"Hello {username}, would you like to see a status report?\")      else:         print(f\"Hello {username}, thank you for logging in again.\") <\/code><\/pre>\n<p>\u6211\u80fd\u60f3\u5230\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u5728\u5f00\u5934\u518d\u52a0\u4e00\u4e2a admin_usernames = [&#8216;admin&#8217;]\uff0c\u7136\u540e if username in admin_usernames \u518d\u8f93\u51fa\uff0c\u4f46\u662f\u611f\u89c9\u4e0d\u592a\u76f4\u63a5\uff0c\u770b\u6765\u4e0d\u80fd\u53ea\u770b\u4e00\u672c\u4e66\u6765\u5b66\u4e60\u4e00\u4e2a\u4e1c\u897f\uff0c\u8fd8\u662f\u8981\u591a\u627e\u51e0\u672c\u7efc\u5408\u6765\u770b\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1149366\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lhx2008 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u4ee3\u7801\u6709\u70b9\u4e0a\u5934                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149367\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lhx2008 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             test=&#8221;admin&#8221; in usernames<br \/>test \u662f true                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149368\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ruike007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u989d\uff0c\u4e5f\u8bb8\u4f60\u5c11\u4e86\u4e2a\u53cc\u5f15\u53f7====<br \/>if username == &#8216;admin&#8217;:                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149369\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8fd9\u4e2a\uff0c\uff0c\uff0c\uff0c\uff0c\uff0c\u4e0d\u5e94\u8be5\u662f if username == &#8220;admin&#8221;: \u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149370\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jeblur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u5565\u6211\u521a\u624d\u52a0\u5f15\u53f7\u4e5f\u4e0d\u884c\uff0c\u542c\u4e86\u4f60\u4eec\u7684\u5efa\u8bae\u52a0\u4e0a\u5c31\u53ef\u4ee5\u4e86\u3002\u3002\u8111\u58f3\u75bc                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149371\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jeblur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u81ea\u6c89\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149372\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fzzff <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             admin&#8211;&gt;\u8fd9\u53eb\u53d8\u91cf, &#8216;admin&#8217; &#8211;&gt; \u8fd9\u53eb\u5b57\u7b26\u4e32&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149373\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jeblur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @fzzff \u5b57\u7b26\u4e32\u662f string \u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149374\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : smallpython <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5efa\u8bae\u770b python-\u6838\u5fc3\u7f16\u7a0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1149375\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Cmdhelp <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u5148\u628a\u57fa\u7840\u5b66\u597d\u554a\uff0c\uff0c\uff0c\uff0c\u6700\u8fd1\u670b\u53cb\u5b66 python\uff0c\uff0c\uff0cstr \u5f53\u53d8\u91cf\u547d\u540d\uff0c\u54ce                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python \u5b66\u4e60\u4e4b\u770b\u4e66\u505a\u9898\u6709\u611f &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/93533"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=93533"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/93533\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93533"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}