try: low_level_os_operation() except* OSError as eg: for e in eg.exceptions: print(type(e).__name__)