The syntax of splitlines() is:
The splitlines() takes maximum of 1 parameter.
keepends (optional) - If keepends is provided and True, line breaks are also included in items of the list.
By default, the line breaks are not included.
The splitlines() returns a list of lines in the string.
If there are not line break characters, it returns a list with single item (a single line).
The splitlines() splits on the following line boundaries:
grocery = 'Milk\nChicken\r\nBread\rButter'
grocery = 'Milk Chicken Bread Butter'
When you run the program, the output will be:
['Milk', 'Chicken', 'Bread', 'Butter']
['Milk\n', 'Chicken\r\n', 'Bread\r', 'Butter']
['Milk Chicken Bread Butter']