{"id":3621,"date":"2024-09-17T10:24:36","date_gmt":"2024-09-17T02:24:36","guid":{"rendered":"http:\/\/khsci.com\/docs\/?p=3621"},"modified":"2024-10-26T20:51:28","modified_gmt":"2024-10-26T12:51:28","slug":"pythonimport","status":"publish","type":"post","link":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/","title":{"rendered":"Python\u7684\u6570\u636e\u5bfc\u5165"},"content":{"rendered":"         <style>\r\n             #player69fa2d174745b.h5vp_player { widthborder-radius overflow: hidden; }        <\/style>\r\n        <div id=\"h5vp_player\">\r\n            <div id=\"player69fa2d174745b\" class=\"h5vp_player h5vp_player_initializer\" data-settings=\"{&quot;options&quot;:{&quot;controls&quot;:[&quot;play-large&quot;,&quot;rewind&quot;,&quot;play&quot;,&quot;fast-forward&quot;,&quot;progress&quot;,&quot;current-time&quot;,&quot;mute&quot;,&quot;volume&quot;,&quot;settings&quot;,&quot;fullscreen&quot;],&quot;loop&quot;:{&quot;active&quot;:false},&quot;muted&quot;:false,&quot;hideControls&quot;:true,&quot;autoplay&quot;:false,&quot;tooltips&quot;:{&quot;controls&quot;:true,&quot;seek&quot;:true},&quot;resetOnEnd&quot;:true,&quot;captions&quot;:{&quot;active&quot;:true,&quot;update&quot;:true}},&quot;infos&quot;:{&quot;source&quot;:&quot;https:\\\/\\\/khscience.vip:555\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/python\\u6570\\u636e\\u5bfc\\u5165_x264.mp4&quot;,&quot;poster&quot;:false,&quot;id&quot;:0}}\">\r\n                <video controls playsinline poster=\"\"  >\r\n                    <source src=\"https:\/\/khscience.vip:555\/wp-content\/uploads\/2024\/09\/python\u6570\u636e\u5bfc\u5165_x264.mp4\" type=\"video\/mp4\">\r\n                    Your browser does not support the video tag.\r\n                <\/video>\r\n            <\/div>\r\n        <\/div>\r\n        \n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-1 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-100 has-custom-font-size is-style-outline has-small-font-size\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.bilibili.com\/video\/BV1GY1xYjEsr\/?vd_source=5e65959f8a047340cb194f5cc1d54eb4\" target=\"_blank\" rel=\"noreferrer noopener\">\u89c6\u9891\u5907\u7528\u5730\u5740<\/a><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ecb\u7ecd<\/h2>\n\n\n\n<p>\u5927\u5bb6\u597d\uff0c\u6b22\u8fce\u6765\u5230\u6211\u4eec\u7684Python\u6570\u636e\u5bfc\u5165\u8fdb\u9636\u8bfe\u7a0b\u3002\u5728\u8fd9\u4e2a\u89c6\u9891\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u5728Python\u9879\u76ee\u4e2d\u5bfc\u5165\u5404\u79cd\u5e38\u89c1\u7684\u6570\u636e\u683c\u5f0f\uff0c\u5305\u62ecCSV\u3001Excel\u3001TXT\u548cNPZ\u6587\u4ef6\u3002\u6211\u4eec\u4f1a\u4ecb\u7ecd\u57fa\u672c\u7684\u5bfc\u5165\u65b9\u6cd5\uff0c\u5e76\u8ba8\u8bba\u4e00\u4e9b\u91cd\u8981\u7684\u6ce8\u610f\u4e8b\u9879\u3002\u8ba9\u6211\u4eec\u5f00\u59cb\u5427\uff01<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u5bfc\u5165CSV\u6587\u4ef6<\/h2>\n\n\n\n<p>CSV\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u6587\u4ef6\u662f\u6570\u636e\u79d1\u5b66\u4e2d\u6700\u5e38\u89c1\u7684\u6570\u636e\u683c\u5f0f\u4e4b\u4e00\u3002\u6211\u4eec\u5c06\u4f7f\u7528pandas\u5e93\u6765\u5bfc\u5165CSV\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">import pandas as pd\n\n# \u57fa\u672c\u8bfb\u53d6CSV\u6587\u4ef6\ndf = pd.read_csv(&#039;data.csv&#039;)\n\n# \u663e\u793a\u524d\u51e0\u884c\nprint(df.head())\n\n# \u5904\u7406\u7f3a\u5931\u503c\ndf_missing = pd.read_csv(&#039;data_with_missing.csv&#039;, na_values=[&#039;NA&#039;, &#039;Missing&#039;])\n\n# \u53ea\u8bfb\u53d6\u7279\u5b9a\u7684\u5217\ndf_selected = pd.read_csv(&#039;data_large.csv&#039;, usecols=[&#039;id&#039;, &#039;name&#039;, &#039;value&#039;])<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n\n\n\n<ol>\n<li>\u59cb\u7ec8\u68c0\u67e5CSV\u6587\u4ef6\u7684\u5206\u9694\u7b26\u3002\u867d\u7136\u9017\u53f7\u662f\u6700\u5e38\u89c1\u7684\uff0c\u4f46\u6709\u65f6\u4e5f\u4f1a\u9047\u5230\u5236\u8868\u7b26\uff08\\t\uff09\u6216\u5206\u53f7\uff08;\uff09\u5206\u9694\u7684\u6587\u4ef6\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528<code>na_values<\/code>\u53c2\u6570\u6307\u5b9a\u54ea\u4e9b\u503c\u5e94\u88ab\u89c6\u4e3a\u7f3a\u5931\u503c\u3002<\/li>\n\n\n\n<li>\u5982\u679cCSV\u6587\u4ef6\u6ca1\u6709\u6807\u9898\u884c\uff0c\u4f7f\u7528<code>header=None<\/code>\u53c2\u6570\uff0c\u5e76\u53ef\u4ee5\u7528<code>names<\/code>\u53c2\u6570\u6307\u5b9a\u5217\u540d\u3002<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u5927\u6587\u4ef6\uff0c\u8003\u8651\u53ea\u8bfb\u53d6\u9700\u8981\u7684\u5217\u6765\u63d0\u9ad8\u6548\u7387\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u5bfc\u5165Excel\u6587\u4ef6<\/h2>\n\n\n\n<p>Excel\u6587\u4ef6\u5728\u5546\u4e1a\u73af\u5883\u4e2d\u975e\u5e38\u666e\u904d\u3002pandas\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5de5\u5177\u6765\u5904\u7406Excel\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">import pandas as pd\n\n# \u8bfb\u53d6Excel\u6587\u4ef6\u7684\u7b2c\u4e00\u4e2a\u5de5\u4f5c\u8868\ndf_excel = pd.read_excel(&#039;data.xlsx&#039;)\n\n# \u8bfb\u53d6\u7279\u5b9a\u7684\u5de5\u4f5c\u8868\ndf_sheet = pd.read_excel(&#039;data.xlsx&#039;, sheet_name=&#039;Sheet2&#039;)\n\n# \u8df3\u8fc7\u524d\u51e0\u884c\ndf_skip = pd.read_excel(&#039;data.xlsx&#039;, skiprows=2)\n\n# \u8bfb\u53d6\u7279\u5b9a\u8303\u56f4\u7684\u5355\u5143\u683c\ndf_range = pd.read_excel(&#039;data.xlsx&#039;, usecols=&quot;B:D&quot;, skiprows=1, nrows=4)\n\nprint(df_excel.head())<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n\n\n\n<ol>\n<li>\u786e\u4fdd\u5df2\u5b89\u88c5<code>openpyxl<\/code>\u5e93\uff0c\u7279\u522b\u662f\u5904\u7406\u8f83\u65b0\u7684.xlsx\u6587\u4ef6\u65f6\u3002\u53ef\u4ee5\u901a\u8fc7<code>pip install openpyxl<\/code>\u5b89\u88c5\u3002<\/li>\n\n\n\n<li>Excel\u6587\u4ef6\u53ef\u80fd\u5305\u542b\u591a\u4e2a\u5de5\u4f5c\u8868\u3002\u4f7f\u7528<code>sheet_name<\/code>\u53c2\u6570\u6307\u5b9a\u8981\u8bfb\u53d6\u7684\u5de5\u4f5c\u8868\u3002<\/li>\n\n\n\n<li>\u8981\u8bfb\u53d6\u7279\u5b9a\u8303\u56f4\u7684\u5355\u5143\u683c\uff0c\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528<code>usecols<\/code>\u3001<code>skiprows<\/code>\u548c<code>nrows<\/code>\u53c2\u6570\u3002<\/li>\n<\/ol>\n\n\n\n<ul>\n<li><code>usecols<\/code>\u6307\u5b9a\u5217\u8303\u56f4\uff08\u5982&#8221;B:D&#8221;\u8868\u793aB\u5230D\u5217\uff09<\/li>\n\n\n\n<li><code>skiprows<\/code>\u6307\u5b9a\u8981\u8df3\u8fc7\u7684\u884c\u6570<\/li>\n\n\n\n<li><code>nrows<\/code>\u6307\u5b9a\u8981\u8bfb\u53d6\u7684\u884c\u6570<\/li>\n<\/ul>\n\n\n\n<ol>\n<li>Excel\u6587\u4ef6\u53ef\u80fd\u5305\u542b\u683c\u5f0f\u5316\u4fe1\u606f\uff08\u5982\u65e5\u671f\uff09\u3002pandas\u4f1a\u5c1d\u8bd5\u81ea\u52a8\u89e3\u91ca\u8fd9\u4e9b\u683c\u5f0f\uff0c\u4f46\u6709\u65f6\u53ef\u80fd\u9700\u8981\u624b\u52a8\u6307\u5b9a\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u5bfc\u5165TXT\u6587\u4ef6<\/h2>\n\n\n\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06\u4e13\u6ce8\u4e8e\u5904\u7406\u53ea\u5305\u542b\u4e00\u5217\u6570\u636e\u7684TXT\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">import pandas as pd\n\n# \u5982\u679c\u6587\u4ef6\u6ca1\u6709\u5206\u9694\u7b26\uff0c\u6bcf\u884c\u5c31\u662f\u4e00\u4e2a\u503c\ndf_txt_no_sep = pd.read_csv(&#039;single_column_no_separator.txt&#039;, header=None, names=[&#039;value&#039;])\n\nprint(df_txt_no_sep.head())<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n\n\n\n<ol>\n<li>\u5bf9\u4e8e\u5355\u5217\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528pandas\u7684<code>read_csv()<\/code>\u51fd\u6570\uff0c\u5373\u4f7f\u6587\u4ef6\u6269\u5c55\u540d\u662f.txt\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u6587\u4ef6\u6ca1\u6709\u6807\u9898\uff0c\u4f7f\u7528<code>header=None<\/code>\u5e76\u901a\u8fc7<code>names<\/code>\u53c2\u6570\u6307\u5b9a\u5217\u540d\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u5bfc\u5165NPZ\u6587\u4ef6<\/h2>\n\n\n\n<p>NPZ\u6587\u4ef6\u662fNumPy\u7684\u538b\u7f29\u5b58\u6863\u683c\u5f0f\uff0c\u901a\u5e38\u7528\u4e8e\u9ad8\u6548\u5730\u5b58\u50a8\u591a\u4e2a\u6570\u503c\u6570\u7ec4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">import numpy as np\n\n# \u52a0\u8f7dNPZ\u6587\u4ef6\ndata = np.load(&#039;data.npz&#039;)\n\n# \u67e5\u770b\u6587\u4ef6\u4e2d\u5305\u542b\u7684\u6570\u7ec4\u540d\u79f0\nprint(&quot;Arrays in the NPZ file:&quot;, data.files)\n\n# \u8bbf\u95ee\u6587\u4ef6\u4e2d\u7684\u7279\u5b9a\u6570\u7ec4\narray1 = data[&#039;array1&#039;]\narray2 = data[&#039;array2&#039;]\n\nprint(&quot;Shape of array1:&quot;, array1.shape)\nprint(&quot;Shape of array2:&quot;, array2.shape)\n\n# \u904d\u5386\u5e76\u6253\u5370\u6240\u6709\u6570\u7ec4\nfor key in data.files:\n    print(f&quot;\\nArray &#039;{key}&#039;:&quot;)\n    print(data[key])\n\n# \u5173\u95edNPZ\u6587\u4ef6\ndata.close()<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n\n\n\n<ol>\n<li>NPZ\u6587\u4ef6\u53ef\u4ee5\u5305\u542b\u591a\u4e2a\u547d\u540d\u6570\u7ec4\u3002\u4f7f\u7528<code>files<\/code>\u5c5e\u6027\u67e5\u770b\u6240\u6709\u6570\u7ec4\u7684\u540d\u79f0\u3002<\/li>\n\n\n\n<li>\u8bb0\u5f97\u5728\u4f7f\u7528\u5b8cNPZ\u6587\u4ef6\u540e\u5173\u95ed\u5b83\u3002<\/li>\n\n\n\n<li>NPZ\u6587\u4ef6\u975e\u5e38\u9002\u5408\u5b58\u50a8\u548c\u52a0\u8f7d\u5927\u578b\u6570\u503c\u6570\u636e\u96c6\uff0c\u56e0\u4e3a\u5b83\u4eec\u662f\u538b\u7f29\u7684\uff0c\u53ef\u4ee5\u8282\u7701\u7a7a\u95f4\u3002<\/li>\n\n\n\n<li>\u6ce8\u610f\u5185\u5b58\u4f7f\u7528\uff1a\u5f53\u4f60\u8bbf\u95eeNPZ\u6587\u4ef6\u4e2d\u7684\u6570\u7ec4\u65f6\uff0c\u6574\u4e2a\u6570\u7ec4\u4f1a\u88ab\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4ecb\u7ecd \u5927\u5bb6\u597d\uff0c\u6b22\u8fce\u6765\u5230\u6211\u4eec\u7684Python\u6570\u636e\u5bfc\u5165\u8fdb\u9636\u8bfe\u7a0b\u3002\u5728\u8fd9\u4e2a\u89c6\u9891\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u5728Python\u9879\u76ee\u4e2d\u5bfc\u5165 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.13 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python\u7684\u6570\u636e\u5bfc\u5165 - \u5de5\u5177\u7bb1\u6587\u6863<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\u7684\u6570\u636e\u5bfc\u5165 - \u5de5\u5177\u7bb1\u6587\u6863\" \/>\n<meta property=\"og:description\" content=\"\u4ecb\u7ecd \u5927\u5bb6\u597d\uff0c\u6b22\u8fce\u6765\u5230\u6211\u4eec\u7684Python\u6570\u636e\u5bfc\u5165\u8fdb\u9636\u8bfe\u7a0b\u3002\u5728\u8fd9\u4e2a\u89c6\u9891\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u5728Python\u9879\u76ee\u4e2d\u5bfc\u5165 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/\" \/>\n<meta property=\"og:site_name\" content=\"\u5de5\u5177\u7bb1\u6587\u6863\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-17T02:24:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-26T12:51:28+00:00\" \/>\n<meta name=\"author\" content=\"kuohao\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"kuohao\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/\"},\"author\":{\"name\":\"kuohao\",\"@id\":\"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5\"},\"headline\":\"Python\u7684\u6570\u636e\u5bfc\u5165\",\"datePublished\":\"2024-09-17T02:24:36+00:00\",\"dateModified\":\"2024-10-26T12:51:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/\"},\"wordCount\":37,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/\",\"url\":\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/\",\"name\":\"Python\u7684\u6570\u636e\u5bfc\u5165 - \u5de5\u5177\u7bb1\u6587\u6863\",\"isPartOf\":{\"@id\":\"https:\/\/www.khsci.com\/docs\/#website\"},\"datePublished\":\"2024-09-17T02:24:36+00:00\",\"dateModified\":\"2024-10-26T12:51:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.khsci.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\u7684\u6570\u636e\u5bfc\u5165\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.khsci.com\/docs\/#website\",\"url\":\"https:\/\/www.khsci.com\/docs\/\",\"name\":\"\u5de5\u5177\u7bb1\u6587\u6863\",\"description\":\"khToolbox\",\"publisher\":{\"@id\":\"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.khsci.com\/docs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5\",\"name\":\"kuohao\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/khsci.com\/docs\/wp-content\/uploads\/2022\/11\/logo-1.png\",\"contentUrl\":\"https:\/\/khsci.com\/docs\/wp-content\/uploads\/2022\/11\/logo-1.png\",\"width\":255,\"height\":97,\"caption\":\"kuohao\"},\"logo\":{\"@id\":\"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.khsci.com\/docs\/index.php\/author\/kuohao\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python\u7684\u6570\u636e\u5bfc\u5165 - \u5de5\u5177\u7bb1\u6587\u6863","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/","og_locale":"zh_CN","og_type":"article","og_title":"Python\u7684\u6570\u636e\u5bfc\u5165 - \u5de5\u5177\u7bb1\u6587\u6863","og_description":"\u4ecb\u7ecd \u5927\u5bb6\u597d\uff0c\u6b22\u8fce\u6765\u5230\u6211\u4eec\u7684Python\u6570\u636e\u5bfc\u5165\u8fdb\u9636\u8bfe\u7a0b\u3002\u5728\u8fd9\u4e2a\u89c6\u9891\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u5728Python\u9879\u76ee\u4e2d\u5bfc\u5165 [&hellip;]","og_url":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/","og_site_name":"\u5de5\u5177\u7bb1\u6587\u6863","article_published_time":"2024-09-17T02:24:36+00:00","article_modified_time":"2024-10-26T12:51:28+00:00","author":"kuohao","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"kuohao","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#article","isPartOf":{"@id":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/"},"author":{"name":"kuohao","@id":"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5"},"headline":"Python\u7684\u6570\u636e\u5bfc\u5165","datePublished":"2024-09-17T02:24:36+00:00","dateModified":"2024-10-26T12:51:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/"},"wordCount":37,"commentCount":0,"publisher":{"@id":"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/","url":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/","name":"Python\u7684\u6570\u636e\u5bfc\u5165 - \u5de5\u5177\u7bb1\u6587\u6863","isPartOf":{"@id":"https:\/\/www.khsci.com\/docs\/#website"},"datePublished":"2024-09-17T02:24:36+00:00","dateModified":"2024-10-26T12:51:28+00:00","breadcrumb":{"@id":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.khsci.com\/docs\/index.php\/2024\/09\/17\/pythonimport\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.khsci.com\/docs\/"},{"@type":"ListItem","position":2,"name":"Python\u7684\u6570\u636e\u5bfc\u5165"}]},{"@type":"WebSite","@id":"https:\/\/www.khsci.com\/docs\/#website","url":"https:\/\/www.khsci.com\/docs\/","name":"\u5de5\u5177\u7bb1\u6587\u6863","description":"khToolbox","publisher":{"@id":"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.khsci.com\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/44b1dc94a273203f641349de36ebc0a5","name":"kuohao","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/image\/","url":"https:\/\/khsci.com\/docs\/wp-content\/uploads\/2022\/11\/logo-1.png","contentUrl":"https:\/\/khsci.com\/docs\/wp-content\/uploads\/2022\/11\/logo-1.png","width":255,"height":97,"caption":"kuohao"},"logo":{"@id":"https:\/\/www.khsci.com\/docs\/#\/schema\/person\/image\/"},"url":"https:\/\/www.khsci.com\/docs\/index.php\/author\/kuohao\/"}]}},"_links":{"self":[{"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/posts\/3621"}],"collection":[{"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/comments?post=3621"}],"version-history":[{"count":8,"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/posts\/3621\/revisions"}],"predecessor-version":[{"id":3718,"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/posts\/3621\/revisions\/3718"}],"wp:attachment":[{"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/media?parent=3621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/categories?post=3621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.khsci.com\/docs\/index.php\/wp-json\/wp\/v2\/tags?post=3621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}