{"id":2945,"date":"2020-02-16T12:08:48","date_gmt":"2020-02-16T04:08:48","guid":{"rendered":"http:\/\/www.sniper97.cn\/?p=2945"},"modified":"2020-02-16T12:08:48","modified_gmt":"2020-02-16T04:08:48","slug":"%e3%80%90leetcode%e3%80%910065%e5%89%91%e6%8c%87offer20-%e6%9c%89%e6%95%88%e6%95%b0%e5%ad%97%e8%a1%a8%e7%a4%ba%e6%95%b0%e5%80%bc%e7%9a%84%e5%ad%97%e7%ac%a6%e4%b8%b2","status":"publish","type":"post","link":"http:\/\/www.sniper97.cn\/index.php\/note\/algorithm\/2945\/","title":{"rendered":"\u3010LeetCode\u30110065&amp;\u5251\u6307Offer20 \u6709\u6548\u6570\u5b57&amp;\u8868\u793a\u6570\u503c\u7684\u5b57\u7b26\u4e32"},"content":{"rendered":"\n<p><a href=\"https:\/\/leetcode-cn.com\/problems\/valid-number\/\">https:\/\/leetcode-cn.com\/problems\/valid-number\/<\/a><\/p>\n\n\n<p><a href=\"https:\/\/leetcode-cn.com\/problems\/biao-shi-shu-zhi-de-zi-fu-chuan-lcof\/\">https:\/\/leetcode-cn.com\/problems\/biao-shi-shu-zhi-de-zi-fu-chuan-lcof\/<\/a><\/p>\n\n\n<pre class=\"wp-block-preformatted\"># -*- coding:utf-8 -*-\n<em>\n<\/em>class Solution(object):\n    def isNumber(self, s):\n        <em>\"\"\"\n        <\/em><strong><em>:type<\/em><\/strong><em> s: str\n        <\/em><strong><em>:rtype<\/em><\/strong><em>: bool\n        \"\"\"\n        <\/em>try:\n            float(s)\n            return True\n        except:\n            return False\nif __name__ == '__main__':\n    s = '5e4'\n    print(float(s))\n    print(Solution().isNumber(s))\n<\/pre>\n\n\n<p><strong>\u601d\u8def<\/strong>\uff1a\u786c\u53d6\u5de7\u3002<\/p>\n\n\n<p>\u8fd9\u9053\u9898\u7684\u6b63\u89c4\u601d\u8def\u5e94\u8be5\u662f\u72b6\u6001\u673a\uff0c\u7c7b\u4f3c\u4e8e\u8bbe\u8ba1\u6a21\u5f0f\u4e2d\u7684\u72b6\u6001\u673a\uff0c\u7ef4\u62a4\u4e00\u4e2a\u72b6\u6001\u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u8868\u793a\u5f53\u5f53\u524d\u72b6\u6001\u662fi\u65f6\uff0c\u4e0b\u4e00\u4e2a\u72b6\u6001\u662fj\u65f6\u5e94\u8be5\u8f93\u51fa\u7684\u72b6\u6001\u3002\u6bcf\u6b21\u8bfb\u53d6\u4e00\u4e2a\u5b57\u7b26\uff0c\u4f9d\u6b21\u5411\u540e\u5224\u65ad\u3002<\/p>\n\n\n<pre class=\"wp-block-code\"><code>\n\t\/\/ \u6570\u5b57\uff0c\u6307\u6570\uff0c\u6b63\u8d1f\uff0c\u5c0f\u6570\u70b9\uff0c\u7a7a\u683c\uff0c\u5176\u4ed6\u5b57\u7b26\n\t\/\/ 0\t 1    2\t   3\t 4       5\n\t\t{1, 10, 8, 11, 0, 10},\n\t\t{1, 3, 10, 2, 6, 10},\n\t\t{7, 3, 10, 10, 6, 10},\n\t\t{5, 10, 4, 10, 10, 10},\n\t\t{5, 10, 10, 10, 10, 10},\n\t\t{5, 10, 10, 10, 6, 10},\n\t\t{10, 10, 10, 10, 6, 10},\n\t\t{7, 3, 10, 10, 6, 10},\n\t\t{9, 10, 10, 11, 10, 10},\n\t\t{9, 3, 10, 2, 6, 10},\n\t\t{10, 10, 10, 10, 10, 10},\n\t\t{7, 10, 10, 10, 10, 10},\n\t<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/leetcode-cn.com\/problems\/valid-number\/ htt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10],"tags":[],"views":1874,"_links":{"self":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/2945"}],"collection":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2945"}],"version-history":[{"count":0,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/2945\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2945"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}