擅长:python、mysql、java
<blockquote>
<p>First of all if you want to import a module to your program, they must be in the same directory.</p>
</blockquote>
<p>导入模块时按此操作</p>
<pre><code>from filename import classname
</code></pre>
<blockquote>
<p>Which is the <em>filename= your .py file</em> that you want to import class</p>
<p><em>class</em> is the specific class that you want to use.</p>
</blockquote>
<p><strong>或</strong></p>
^{pr2}$
<blockquote>
<p>Which is going to add all functions and classes.</p>
<p>Also check this topic. <a href="https://stackoverflow.com/questions/27664543/program-is-running-fine-but-cannot-being-import-with-indexerror/27664558#27664558">program is running fine but cannot being import with IndexError</a></p>
</blockquote>