1. Home
  2. Data Science
  3. Python
  4. Which method splits a string into lines in Python?

Added 25 Nov 2026

Which method splits a string into lines in Python?

  1. lines()
  2. split_lines()
  3. splitlines() Correct answer
  4. newlines()

Correct answer

C. splitlines()

MCQSEXAM

Explanation

splitlines() splits at line boundaries and returns a list of lines.

Reference

Asked in: Python Interview Strings

https://docs.python.org/3/library/stdtypes.html#string-methods

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs