splitlines()

All String methods

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


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





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