擅长:python、mysql、java
<p>以下方法打印类实例的<code>['self.pdbcode', 'self.raw', 'self.year']</code>:</p>
<pre><code>class Antibody():
...
def get_fields(self):
ret = []
for nm in dir(self):
if not nm.startswith('__') and not callable(getattr(self, nm)):
ret.append('self.' + nm)
return ret
a = Antibody(0)
print a.get_fields()
</code></pre>