Code: Alles auswählen
try:
spam()
except Exception:
# e.g. clean up and exit
eggs()
throw_exception(Exception)
return
Code: Alles auswählen
try:
spam()
except Exception:
# e.g. clean up and exit
eggs()
throw_exception(Exception)
return
Code: Alles auswählen
try:
spam()
except Exception:
eggs()
raise
Falls du evtl eine andere Funktion verwenden moechtest, kannst du die Exception auch uebergeben (ist ja wie alles andere in Python auch, ein Objekt) jederzeit werfen. Also beispielsweise so:droptix hat geschrieben:Sieht gut aus Danke!
Code: Alles auswählen
def wirf(e): raise e
def funktion(**args):
try: something()
except Exception, e: wirf(e)