great deal of text on multiple lines and we want to split it into single lines we can do so by using the split method with the appropriate separator for instanceon linux and mac systemssthe line separator is \nt ' st line\ nd line\ rd lineprint st line nd line rd line split('\ '[' st line'' nd line'' rd line'this example works fine on mac or linuxbut the line separator on windows is not \nbut \ \nandfor platform-independent solutionit is better to use the method splitlines()which works with both line separatorst ' st line\ nd line\ rd line#unix format splitlines([' st line'' nd line'' rd line' ' st line\ \ nd line\ \ rd linewindows splitlines(cross platform[' st line'' nd line'' rd line'strings are constant immutable objects in many of the examples abovewe highlighted the similarity between strings and listssince we are very familiar with lists from earlier howeverstrings are even more similar to tuplessince they are immutable objects we could change the elements of list in place by indexing into the listbut this does not work for strings trying to assign new value to part of string will result in an error messages[ typeerror'strobject does not support item assignment insteadto perform such replacementwe can build new string manually by adding pieces of the original string or use the replace method introduced abovebuild new string by adding pieces of ss [: ' [ : 'berlin at pms replace( [ ], 'berlin at pmthe fact that strings are immutablebut still have method such as replacecould be confusing to some how can we replace substring with another if strings are immutable objectsthe answer is that replace does not really change the original stringbut returns new one this behavior is similar tofor instancethe call split()which will not turn into list but