擅长:python、mysql、java
<p>您可以使用<code>ProcessEvent</code>的<code>__call__</code>方法来集中对<code>suffix_filter</code>的调用:</p>
<pre><code>class EventHandler(pyinotify.ProcessEvent):
def __call__(self, event):
if not suffix_filter(event.name):
super(EventHandler, self).__call__(event)
def process_IN_CREATE(self, event):
print "Creating:", event.pathname
def process_IN_DELETE(self, event):
print "Removing:", event.pathname
def process_IN_MODIFY(self, event):
print "Modifying:", event.pathname
</code></pre>