python:les_modules
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
python:les_modules [2016/10/29 10:31] – [Ctypes] root | python:les_modules [2017/06/03 13:08] (Version actuelle) – [readline] root | ||
---|---|---|---|
Ligne 405: | Ligne 405: | ||
<code python readline.py> | <code python readline.py> | ||
- | # | ||
- | |||
import readline, signal | import readline, signal | ||
- | prompt = ' | + | prompt = 'GigiX > ' |
def signal_handler(signal, | def signal_handler(signal, | ||
- | | + | |
- | | + | input(prompt) |
- | return | + | return |
signal.signal(signal.SIGINT, | signal.signal(signal.SIGINT, | ||
Ligne 423: | Ligne 421: | ||
def _parser(self, | def _parser(self, | ||
- | if search is None: | + | if (search is None) or (callable(search) == True): |
return [] | return [] | ||
elif len(line) == 0: | elif len(line) == 0: | ||
Ligne 437: | Ligne 435: | ||
results = self._parser(line, | results = self._parser(line, | ||
return results[state] | return results[state] | ||
+ | |||
+ | def linux_sles_12(): | ||
+ | print(' | ||
tree = { | tree = { | ||
- | | + | |
- | | + | ' |
- | | + | ' |
- | | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | } |
- | ' | + | |
- | }, | + | ' |
- | ' | + | ' |
- | | + | ' |
- | ' | + | ' |
- | | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | }, |
- | ' | + | ' |
- | ' | + | ' |
- | }, | + | ' |
- | | + | ' |
- | | + | ' |
- | ' | + | ' |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | }, | + | |
- | ' | + | |
- | { | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | } | + | |
- | } | + | |
}, | }, | ||
- | 'windows': | + | 'SLES': |
- | { | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | } |
- | } | + | }, |
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | | ||
} | } | ||
Ligne 495: | Ligne 490: | ||
l = '' | l = '' | ||
while l != (' | while l != (' | ||
- | | + | |
- | l = raw_input(prompt) | + | l = input(prompt) |
- | except EOFError: | + | |
- | + | | |
- | break | + | print(' |
- | except: | + | break |
- | continue | + | except: |
+ | continue | ||
</ | </ | ||
python/les_modules.1477737110.txt.gz · Dernière modification : 2016/10/29 10:31 de root