0
How to print the words before a newline break?
I have a large text sperated by a new lines. I want to parse the words before the newline and append it to a list as a1. Then the words after the newline break as a2 and so on. Example: MM = "hello there how are you?\nIam good thanks" a1 should equal to "hello there how are you?" And a2 should equal to "I am good thanks"
4 Answers
+ 2
a = MM.split("\n")
print(a[0])
print(a[1])
+ 1
I solved it. I only needed to do MM.splitlines()
0
also :D
0
visph Thanks buddy. :)