擅长:python、mysql、java
<p>您需要将另一个文件作为模块导入,如下所示:</p>
<pre><code>import Math
</code></pre>
<p>如果不想在<code>Calculate</code>函数前面加上模块名,请执行以下操作:</p>
<pre><code>from Math import Calculate
</code></pre>
<p>如果要导入模块的所有成员,请执行以下操作:</p>
<pre><code>from Math import *
</code></pre>
<p><strong>编辑:</strong><a href="https://linux.die.net/diveintopython/html/object_oriented_framework/importing_modules.html" rel="nofollow noreferrer">Here is a good chapter</a>来自<a href="https://linux.die.net/diveintopython/html/toc/index.html" rel="nofollow noreferrer">Dive Into Python</a>,在这个主题上更深入一些。</p>