Home >>Python String Methods >Python String splitlines() Method
Python string splitlines() method is used to split the given input string into a list. The splitting is done at line breaks.
Syntax:string.splitlines(keeplinebreaks)
Parameter | Description |
---|---|
keeplinebreaks | This is an optional parameter. It defines if the line breaks should be included or not. |
txt = "Hello, I am Jerry\nWelcome to PHPTPOINT"
x = txt.splitlines()
print(x)
txt = "Hello, I am Jerry\nWelcome to PHPTPOINT"
x = txt.splitlines(True)
print(x)