(continuedexcept ioerror as efor entry in dir( )if (not entry startswith(" "))tryprint(entry" __getattribute__(entry)except attributeerrorprint("attribute "entrynot accessible "elseprint("file opened as expected "file close()in this caseyou begin by getting listing of the attributes associated with the error argument object using the dir(function the output of the dir(function is list of strings containing the names of the attributes that you can print only those arguments that don' start with an under score (_contain useful information about the exception howevereven some of those entries are inaccessibleso you must encase the output code in second try except block (see the "nested exception handlingsectionlater in the for detailsthe attribute name is easy because it' contained in entry to obtain the value associated with that attributeyou must use the __getattribute__(function and supply the name of the attribute you want when you run this codeyou see both the name and the value of each of the attri butes supplied with particular error argument object in this casethe actual output is as followsargs ( 'no such file or directory'attribute characters_written not accessible errno filename myfile txt strerror no such file or directory winerror none with_traceback <built-in method with_traceback of filenotfounderror object at dc handling multiple exceptions with single except clause most applications can generate multiple exceptions for single line of code this fact demonstrated earlier in the with the basicexception py example how you handle the multiple exceptions depends on your goals for the applicationthe types of exceptionsand the relative skill of your users sometimes when working with less skilled userit' simply easier to say that the application experienced nonrecoverable error and then log the details into log file in the application directory or central location using single except clause to handle multiple exceptions works only when common source of action fulfills the needs of all the exception types otherwiseyou need to handle each exception individually the following steps show how to handle multiple exceptions using single except clause this example also appears with the downloadable source code as multipleexception py