splitlines()

splitlines(): split the string by using line breaks as delimiter
splitlines() returns a list after breaking a string using line breaks as delimiter
my_str.splitline(keeplinebreaks) 
keeplinebreaks : optional, True or False, by default it is False for not retaining line breaks Output
my_str='Welcome\n to\n Plus2net'
output=my_str.splitlines()
print(output)

my_str='Welcome\n to\n Plus2net'
output=my_str.splitlines(True)
print(output)
Output is here
['Welcome', ' to', ' Plus2net']
['Welcome\n', ' to\n', ' Plus2net']
All String methods



plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer