擅长:python、mysql、java
<p>如果要调用类方法,则必须使用<code>self</code>调用它们,例如</p>
<pre><code>class myClass:
def __init__(self):
pass
def get_all_predicates(self):
print('asd')
def do_something(self):
self.get_all_predicates() # working
get_all_predicates() # → Unresolved reference
test = myClass()
test.do_something()
</code></pre>
<p>有关Python类的示例,请参见<a href="https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial/Classes#Creating_a_Class" rel="nofollow">this link</a>。</p>