我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用webbrowser.py()。
def ispackage(path): """Guess whether a path refers to a package directory.""" if os.path.isdir(path): for ext in ('.py', '.pyc', '.pyo'): if os.path.isfile(os.path.join(path, '__init__' + ext)): return True return False
def keypress(self, size, key): if not self.app.input_buffer: key = super(SearchDialog, self).keypress(size, key) keys = self.app.input_buffer + [key] commands = self.app.config.keymap.getCommands(keys) if keymap.ACTIVATE in commands: self._emit('search') return None return key # From: cpython/file/2.7/Lib/webbrowser.py with modification to # redirect stdin/out/err.