擅长:python、mysql、java
<p>在实例化类时调用<code>__init__</code>(cf.<a href="https://stackoverflow.com/questions/625083/python-init-and-self-what-do-they-do">this question</a>)。在代码段末尾添加<code>my_instance = MyClass()</code>将创建<code>MyClass</code>类的实例,并应打印出所需的内容:</p>
<pre><code>class MyClass(object):
def __init__(self):
print("stackoverflow is the best !!!")
my_instance = MyClass()
</code></pre>