In this program, we will take a multiline string as input and split a given multiline string into list of lines.
Steps to solve the program
- Take a multiline string as input.
- Split the string on a new line using split() to convert the given string into a list of lines.
- Print the output.
#Input string
str1= "This string Contains\nMultiple\nLines"
#Printing output
print(str1.split("\n"))
Output :
['This string Contains', 'Multiple', 'Lines']