with open('your_filename_here', 'r') as fp:
    string = fp.read()
f1 = open('your_filename_here', 'w')
rx = re.compile(
    """
                (?!^[A-E]\\.)
                (?P<question>.+[\\n\\r])
                (?P<choices>[\\s\\S]+?)
                ^ANSWER:\\ (?P<answer>[A-E])
                """
    , re.MULTILINE | re.VERBOSE)
to convert a MCQ in the required format - python