擅长:python、mysql、java
<p>您还可以使用<code>help()</code>来提供有关类或模块的更多信息。例如:</p>
<pre><code>>>> class Fantasy():
... def womble(self):
... print('I am a womble!')
... def dragon(self):
... """ Make the Dragon roar! """
... print('I am a dragon...ROAR!')
...
>>> help(Fantasy)
Help on class Fantasy in module __main__:
class Fantasy(builtins.object)
| Methods defined here:
|
| dragon(self)
| Make the Dragon roar!
|
| womble(self)
|
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
</code></pre>
<p>当然,如果类/模块中有doc字符串,这会更有用。你知道吗</p>