adspace


write a code for this:trailer recordId contains a value
other than 99, then the file must error with the
reason ‘Invalid RECORD_ID’(User Defined Exception).

Answer Posted / Bipin Gupta

Here's a Python code example that defines and uses a custom exception to handle invalid record IDs.nn```pythonnclass InvalidRecordIdError(Exception):n passndef process_file(file):n trailer = file.readline().strip()n match = re.search(r'^TRAILER:s*(d{2})$', trailer)n if not match or int(match.group(1)) != 99:n raise InvalidRecordIdError('Invalid RECORD_ID')n# rest of the file processing code...``

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Please send ford technologies placement paper 2 my mail id

2174


Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.

2277