GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — PythonIBM/Ejercicio_captura_excepciones2.py at master · 1975Pepe/PythonIBM Expand file tree/ Copy pathEjercicio_captura_excepciones2.pyMore file actions 19 lines (16 loc) · 537 Bytes / Copy pathEjercicio_captura_excepciones2.pyFile metadata and controls19 lines (16 loc) · 537 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 def indexador(objeto, indice): return objeto[indice] try: print(indexador('Python', 'P')) except IndexError: # Captura IndexError print('Error de índice.') except TypeError: # Captura TypeError print('El índice tiene que ser un número.') print('Hemos salido del try-catch') try: print(indexador('Python', 0)) except IndexError: # Captura IndexError print('Error de índice.') except TypeError: # Captura TypeError print('El índice tiene que ser un número.') print('Ahora si funciona el código.') |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |