HOME/Articles/

python code split multiline string into list (snippet)

Article Outline

Python example 'python code split multiline string into list'

Functions in program:

  • def split_lines(s):

python code split multiline string into list

Python code example: python code split multiline string into list

#Split a multiline string into a list of lines

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

More Python: https://pythonprogramminglanguage.com