{"id":373,"date":"2013-01-17T20:52:06","date_gmt":"2013-01-18T01:52:06","guid":{"rendered":"http:\/\/zhanxw.com\/blog\/?p=373"},"modified":"2013-01-17T20:52:06","modified_gmt":"2013-01-18T01:52:06","slug":"%e5%8f%91%e5%b8%83python%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/zhanxw.com\/blog\/2013\/01\/%e5%8f%91%e5%b8%83python%e7%a8%8b%e5%ba%8f\/","title":{"rendered":"\u53d1\u5e03Python\u7a0b\u5e8f"},"content":{"rendered":"<p>\u53d1\u5e03Python\u7a0b\u5e8f<\/p>\n<p>Distribute Python script<\/p>\n<p>\u6700\u8fd1\u9700\u8981\u628a\u4e00\u4e2aPython\u7a0b\u5e8f\u53d1\u5e03\u7ed9\u5176\u4ed6\u5b66\u6821\u7684Collaborators\u4f7f\u7528\uff0c\u53d1\u73b0\u6700\u4e3b\u8981\u7684\u95ee\u9898\u662f\u7248\u672c\u4e0d\u517c\u5bb9\uff1a\u6211\u4f7f\u7528\u7684\u662fPython 2.7\u7248\u672c\uff0c\u4f46\u5176\u4ed6\u5b66\u6821\u53ef\u80fd\u4f7f\u75282.5\u6216\u8005\u66f4\u8001\u76842.4\u7248\u672c\u3002\u56e0\u4e3a\u6211\u4f7f\u7528\u4e86\u5927\u91cf\u65b0\u7248\u7684\u7279\u6709\u529f\u80fd\uff0c\u76f4\u63a5\u628a\u4ee3\u7801\u53d1\u5e03\u7ed9\u5bf9\u65b9\u662f\u6ca1\u6cd5\u8ba9\u5bf9\u65b9\u4f7f\u7528\u7684\u3002\u56e0\u4e3a\u8001\u7248\u672c\u7684Python\u4e0d\u652f\u63012.7\u7248\u91cc\u7684\u51fd\u6570\u6bd4\u5982\uff1aos.SEEK_SET, all(), str.format() \u3002\u89e3\u51b3\u65b9\u6cd5\u6709\u4e24\u4e2a\uff1a<\/p>\n<p>1. \u4f7f\u7528Freeze\u4e4b\u7c7b\u7684\u5de5\u5177<\/p>\n<p>\u5728Python source code\u91cc\u6709\u4e00\u4e2aTools\u6587\u4ef6\u5939\uff0c\u91cc\u9762\u6709freeze\u8fd9\u4e2a\u5de5\u5177\u3002\u4ed6\u53ef\u4ee5\u628aPython\u4ee3\u7801\u7f16\u8bd1\u6210C\u8bed\u8a00\u4e2d\u7684Python\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u89e3\u51b3\u7b80\u5355\u7684\u811a\u672c\uff0c\u4f46\u590d\u6742\u7684\u811a\u672c\u8fd9\u79cd\u65b9\u6cd5\u53ef\u80fd\u4f1a\u5e26\u6765\u5176\u4ed6\u7684\u9519\u8bef\u3002<\/p>\n<p>2. \u91cd\u5199\u4ee3\u7801<\/p>\n<p>\u8fd9\u662f\u6700\u6839\u672c\u7684\u89e3\u51b3\u65b9\u6cd5\uff0c\u628a\u65b0\u7248\u672c\u7279\u6709\u7684\u51fd\u6570\u91cd\u65b0\u5b9a\u4e49\uff0c\u6216\u8005\u7528\u53e6\u4e00\u79cd\u65b9\u6cd5\u5b9e\u73b0\u3002\u6bd4\u5982all()<\/p>\n<pre class=\"brush: python; collapse: false; title: ; wrap-lines: false; notranslate\" title=\"\">\r\n# all is a keyword since Python 2.7                                                                                                                                                  \r\ntry:\r\n    all\r\nexcept:\r\n    def all(iterable):\r\n        for element in iterable:\r\n            if not element:\r\n                return False\r\n            return True\r\n<\/pre>\n<p>\u6709\u4e00\u4e2a\u5de5\u5177\u53ef\u4ee5\u68c0\u67e5\u5f53\u524d\u7684Python\u7684\u5411\u524d\u517c\u5bb9\u6027\uff1a<\/p>\n<p><a href=\"https:\/\/github.com\/ghewgill\/pyqver\" title=\"pyqver\" target=\"_blank\">https:\/\/github.com\/ghewgill\/pyqver<\/a><\/p>\n<p>\u68c0\u67e5checkVCF.py\u7684\u7ed3\u679c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>\/net\/fantasia\/home\/zhanxw\/rvtests\/rvMeta\/sftp.clean\/checkVCF\/checkVCF.py<br \/>\n2.5 all<br \/>\n2.4 set, generator expression<br \/>\n2.3 logging, sum, enumerate<\/p>\n<p>\u5c31\u662f\u8bf4\u6211\u4f7f\u7528\u4e862.5\u7279\u6709\u7684all()\u51fd\u6570\uff0c\u5982\u679c\u60f3\u57282.4\u7248\u7684Python\u4e0a\u8fd0\u884c\uff0c\u9700\u8981\u91cd\u65b0\u5b9a\u4e49all()\u51fd\u6570\u3002<br \/>\n\u7c7b\u4f3c\u7684\uff0cset(), generator expression\u662f2.4\u7248\u624d\u52a0\u5165\u7684\u7279\u6027\uff0c\u5982\u679c\u8981\u652f\u63012.3\u7248\u672c\uff0c\u5c31\u5fc5\u987b\u6539\u5199\u8fd9\u4e24\u4e2a\u5730\u65b9\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53d1\u5e03Python\u7a0b\u5e8f Distribute Python script \u6700\u8fd1\u9700\u8981\u628a\u4e00\u4e2aPython\u7a0b\u5e8f\u53d1\u5e03\u7ed9\u5176\u4ed6\u5b66\u6821\u7684Collaborators\u4f7f\u7528\uff0c\u53d1\u73b0\u6700\u4e3b\u8981\u7684\u95ee\u9898\u662f\u7248\u672c\u4e0d\u517c\u5bb9\uff1a\u6211\u4f7f\u7528\u7684\u662fPython 2.7\u7248\u672c\uff0c\u4f46\u5176\u4ed6\u5b66\u6821\u53ef\u80fd\u4f7f\u75282.5\u6216\u8005\u66f4\u8001\u76842.4\u7248\u672c\u3002\u56e0\u4e3a\u6211\u4f7f\u7528\u4e86\u5927\u91cf\u65b0\u7248\u7684\u7279\u6709\u529f\u80fd\uff0c\u76f4\u63a5\u628a\u4ee3\u7801\u53d1\u5e03\u7ed9\u5bf9\u65b9\u662f\u6ca1\u6cd5\u8ba9\u5bf9\u65b9\u4f7f\u7528\u7684\u3002\u56e0\u4e3a\u8001\u7248\u672c\u7684Python\u4e0d\u652f\u63012.7\u7248\u91cc\u7684\u51fd\u6570\u6bd4\u5982\uff1aos.SEEK_SET, all(), str.format() \u3002\u89e3\u51b3\u65b9\u6cd5\u6709\u4e24\u4e2a\uff1a 1. \u4f7f\u7528Freeze\u4e4b\u7c7b\u7684\u5de5\u5177 \u5728Python source code\u91cc\u6709\u4e00\u4e2aTools\u6587\u4ef6\u5939\uff0c\u91cc\u9762\u6709freeze\u8fd9\u4e2a\u5de5\u5177\u3002\u4ed6\u53ef\u4ee5\u628aPython\u4ee3\u7801\u7f16\u8bd1\u6210C\u8bed\u8a00\u4e2d\u7684Python\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u89e3\u51b3\u7b80\u5355\u7684\u811a\u672c\uff0c\u4f46\u590d\u6742\u7684\u811a\u672c\u8fd9\u79cd\u65b9\u6cd5\u53ef\u80fd\u4f1a\u5e26\u6765\u5176\u4ed6\u7684\u9519\u8bef\u3002 2. \u91cd\u5199\u4ee3\u7801 \u8fd9\u662f\u6700\u6839\u672c\u7684\u89e3\u51b3\u65b9\u6cd5\uff0c\u628a\u65b0\u7248\u672c\u7279\u6709\u7684\u51fd\u6570\u91cd\u65b0\u5b9a\u4e49\uff0c\u6216\u8005\u7528\u53e6\u4e00\u79cd\u65b9\u6cd5\u5b9e\u73b0\u3002\u6bd4\u5982all() # all is a keyword since Python 2.7 try: all except: def all(iterable): for element in iterable: if not element: return False return True \u6709\u4e00\u4e2a\u5de5\u5177\u53ef\u4ee5\u68c0\u67e5\u5f53\u524d\u7684Python\u7684\u5411\u524d\u517c\u5bb9\u6027\uff1a https:\/\/github.com\/ghewgill\/pyqver \u68c0\u67e5checkVCF.py\u7684\u7ed3\u679c\u5982\u4e0b\u6240\u793a\uff1a \/net\/fantasia\/home\/zhanxw\/rvtests\/rvMeta\/sftp.clean\/checkVCF\/checkVCF.py 2.5 all 2.4 set, generator expression 2.3 logging, sum, enumerate [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[97,98,53],"class_list":["post-373","post","type-post","status-publish","format-standard","hentry","category-code","tag-backward","tag-compatibility","tag-python"],"_links":{"self":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts\/373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/comments?post=373"}],"version-history":[{"count":0,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts\/373\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/media?parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/categories?post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/tags?post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}