Advertisement
teslariu

Untitled

Nov 7th, 2020
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4.  
  5. class MiExcepcion(Exception):
  6.     pass
  7.  
  8. try:
  9.     raise MiExcepcion({"mensaje":"Mi Mensaje", "informacion":"Mi Informacion"})
  10. except MiExcepcion as e:
  11.     detalles = e.args[0]
  12.     print(detalles)
  13.     print(detalles["mensaje"])
  14.     print(detalles["informacion"])    
  15.    
  16. #{'mensaje': 'Este es el mensaje', 'informacion': 'Esto es la informacion'}
  17. # Mi Mensaje
  18. # Mi Informacion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement