venture of iit bombay vjti alumni written content in the file successfully example this example tries to open file where you do not have write permissionso it raises an exception #!/usr/bin/python tryfh open("testfile"" "fh write("this is my test file for exception handling!!"except ioerrorprint "errorcan\' find file or read dataelseprint "written content in the file successfullythis produces the following result