{"id":24654,"date":"2021-10-25T09:12:17","date_gmt":"2021-10-25T03:42:17","guid":{"rendered":"https:\/\/python-programs.com\/?p=24654"},"modified":"2021-11-05T19:15:01","modified_gmt":"2021-11-05T13:45:01","slug":"python-string-splitlines-method-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-string-splitlines-method-with-examples\/","title":{"rendered":"Python String splitlines() Method with Examples"},"content":{"rendered":"

In the previous article, we have discussed Python String maketrans() Method with Examples<\/a>
\nsplitlines() Method in Python:<\/strong><\/p>\n

The splitlines() method divides(splits) a string into a list of lines. Line breaks are used for splitting.<\/p>\n

Syntax:<\/strong><\/p>\n

string.splitlines(keeplinebreaks)<\/pre>\n

Parameters<\/strong><\/p>\n

keeplinebreaks:<\/strong> Optional. Specifies whether or not line breaks should be included (True) (False). False is the default value.<\/p>\n

Return Value:\u00a0<\/strong><\/p>\n

splitlines() returns a list of the string’s lines.<\/p>\n

If no line break characters are present, it returns a list with a single item (a single line).<\/p>\n

splitlines() divides lines at the following points:<\/strong><\/p>\n