Python split multiline string to multiple lines
We can use the splitlines()
method to split the multiline string into a list of each individual strings in python.
mString = """Line 1
Line 2
Line 3
Line 4"""
print(mString.splitlines())
Output:
['Line 1', 'Line 2', 'Line 3', 'Line 4']