30 seconds of python

  Back to Home

split_lines

stringbeginner

Splits a multiline string into a list of lines.

Use s.split() and '\n' to match line breaks and create a list.

def split_lines(s):
  return s.split('\n')