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


    âš¡ Azaadi sale - Celebrate Independence Day with Flat 55% Off On all courses! 13 to 17 Aug âš¡ Enroll Now

    Question

    How do you open a file in read mode in Python?

    A open("file.txt", "w") Correct Answer Incorrect Answer
    B open("file.txt", "r") Correct Answer Incorrect Answer
    C open("file.txt", "a") Correct Answer Incorrect Answer
    D open("file.txt", "x") Correct Answer Incorrect Answer
    E open("file.txt", "t") Correct Answer Incorrect Answer

    Solution

    Explanation: To open a file in read mode, you use the open() function with the "r" mode. This will allow you to read the contents of the file but not modify it.

    Practice Next
    ask-question

    Not sure which exam is best for you Talk to our expert

    Get My Free Call