📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What will re.findall(r'\d+', 'abc123def45ghi')

    return? 
    A ['123', '45'] Correct Answer Incorrect Answer
    B ['1', '2', '3', '4', '5'] Correct Answer Incorrect Answer
    C ['abc123def45ghi'] Correct Answer Incorrect Answer
    D None Correct Answer Incorrect Answer

    Solution

    The re.findall() function finds all non-overlapping matches of the pattern. The pattern \d+ matches one or more digits. In the given string, it will find "123" and "45".

    Practice Next
    ask-question