String splitlines() Method in Python 3
The splitlines() method returns a list with all the lines in string, optionally including
the line breaks (if num is supplied and is true).
Syntax
str.splitlines(
num=string.count('\n'))
|
Parameters
num - This is any number, if present then it would be
assumed that the line breaks need to be included in the lines.
Return Value
This method returns true if found matching with the
string otherwise false.
Example
#!/usr/bin/python3
str =
"this is \nstring example....\nwow!!!"
print
(str.splitlines( ))
|
Result
['this
is ', 'string example....', 'wow!!!']
|