Question: I currently have code of the format

```
try:
    ....
except(HTTPError, URLError, socket.error) as e:
    print "error({0}):{1}".format(e.errno, e.strerror)
continue

```

But want to know which of the three triggered the exception. Is there a way to do this in python?

Answer: 
Try using `e.__class__.__name__`. It'll return values like `"ValueError"` or `"TypeError"`.

You could also just use `e.__class__`, which gives you values like `<type 'exceptions.TypeError'>`
```
def exception():
    try:
        //code that could raise a ValueError or TypeError
    except ValueError as e:
        print "ValueError"
    except TypeError as e:
        print "TypeError"

```

Just add more except blocks, each with code specific the a given exception.