Split a given multiline string into list of lines

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
  1. Take a multiline string as input.
  2. Split the string on a new line using split() to convert the given string into a list of lines.
  3. Print the output.
				
					#Input string
str1= "This string Contains\nMultiple\nLines"

#Printing output
print(str1.split("\n"))
				
			

Output :

				
					['This string Contains', 'Multiple', 'Lines']
				
			

extract numbers from a given string

add two strings as they are numbers

Leave a Comment